diff --git a/buildSrc/src/main/groovy/net/corda/testing/KubesTest.groovy b/buildSrc/src/main/groovy/net/corda/testing/KubesTest.groovy index 7ed6bb15f0..70b8950f86 100644 --- a/buildSrc/src/main/groovy/net/corda/testing/KubesTest.groovy +++ b/buildSrc/src/main/groovy/net/corda/testing/KubesTest.groovy @@ -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 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) }) } diff --git a/buildSrc/src/main/java/net/corda/testing/KubePodResult.java b/buildSrc/src/main/java/net/corda/testing/KubePodResult.java index d5f725e646..3549fff9d4 100644 --- a/buildSrc/src/main/java/net/corda/testing/KubePodResult.java +++ b/buildSrc/src/main/java/net/corda/testing/KubePodResult.java @@ -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 waiter; private volatile Integer resultCode = 255; private final File output; private volatile Collection binaryResults = Collections.emptyList(); - KubePodResult(Pod createdPod, CompletableFuture waiter, File output) { + KubePodResult(Pod createdPod, File output) { this.createdPod = createdPod; - this.waiter = waiter; this.output = output; }