mirror of
https://github.com/corda/corda.git
synced 2025-02-26 03:18:57 +00:00
Simplify
This commit is contained in:
parent
6ae9151012
commit
612ec201eb
@ -106,12 +106,12 @@ class KubesTest extends DefaultTask {
|
||||
project.logger.lifecycle("scheduled pod: " + podName)
|
||||
File outputFile = Files.createTempFile("container", ".log").toFile()
|
||||
attachStatusListenerToPod(client, namespace, podName)
|
||||
schedulePodForDeleteOnShutdown(podName, client, createdPod)
|
||||
schedulePodForDeleteOnShutdown(client, createdPod)
|
||||
waitForPodToStart(podName, client, namespace)
|
||||
def stdOutOs = new PipedOutputStream()
|
||||
def stdOutIs = new PipedInputStream(4096)
|
||||
ByteArrayOutputStream errChannelStream = new ByteArrayOutputStream();
|
||||
KubePodResult result = new KubePodResult(createdPod, null, outputFile)
|
||||
KubePodResult result = new KubePodResult(createdPod, outputFile)
|
||||
CompletableFuture<KubePodResult> waiter = new CompletableFuture<>()
|
||||
ExecListener execListener = buildExecListenerForPod(podName, errChannelStream, waiter, result)
|
||||
stdOutIs.connect(stdOutOs)
|
||||
@ -209,10 +209,10 @@ class KubesTest extends DefaultTask {
|
||||
}
|
||||
}
|
||||
|
||||
void schedulePodForDeleteOnShutdown(String podName, client, Pod createdPod) {
|
||||
project.logger.info("attaching shutdown hook for pod ${podName}")
|
||||
void schedulePodForDeleteOnShutdown(client, Pod createdPod) {
|
||||
project.logger.info("attaching shutdown hook for pod ${createdPod.metadata.name}")
|
||||
Runtime.getRuntime().addShutdownHook({
|
||||
println "Deleting pod: " + podName
|
||||
println "Deleting pod: " + createdPod.metadata.name
|
||||
client.pods().delete(createdPod)
|
||||
})
|
||||
}
|
||||
|
@ -5,19 +5,16 @@ import io.fabric8.kubernetes.api.model.Pod;
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class KubePodResult {
|
||||
|
||||
private final Pod createdPod;
|
||||
private final CompletableFuture<Void> waiter;
|
||||
private volatile Integer resultCode = 255;
|
||||
private final File output;
|
||||
private volatile Collection<File> binaryResults = Collections.emptyList();
|
||||
|
||||
KubePodResult(Pod createdPod, CompletableFuture<Void> waiter, File output) {
|
||||
KubePodResult(Pod createdPod, File output) {
|
||||
this.createdPod = createdPod;
|
||||
this.waiter = waiter;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user