From 7f3260e1b3662c5fcd14a32b808d15ecbc2e0365 Mon Sep 17 00:00:00 2001 From: Razvan Codreanu <52859362+Schife@users.noreply.github.com> Date: Wed, 13 Nov 2019 11:33:12 +0000 Subject: [PATCH] TM-89 fixing double archiving and misleading log (#5698) --- .../src/main/groovy/net/corda/testing/KubesTest.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/buildSrc/src/main/groovy/net/corda/testing/KubesTest.java b/buildSrc/src/main/groovy/net/corda/testing/KubesTest.java index 44f60e53d8..1061a49ff9 100644 --- a/buildSrc/src/main/groovy/net/corda/testing/KubesTest.java +++ b/buildSrc/src/main/groovy/net/corda/testing/KubesTest.java @@ -211,6 +211,8 @@ public class KubesTest extends DefaultTask { } }); + int podNumber = podIdx + 1; + try { // pods might die, so we retry return Retry.fixed(numberOfRetries).run(() -> { @@ -247,14 +249,10 @@ public class KubesTest extends DefaultTask { File podOutput = executeBuild(namespace, numberOfPods, podIdx, podName, podLogsDirectory, printOutput, stdOutOs, stdOutIs, errChannelStream, waiter); int resCode = waiter.join(); - getProject().getLogger().lifecycle("build has ended on on pod " + podName + " (" + podIdx + "/" + numberOfPods + ") with result " + resCode + " , gathering results"); + getProject().getLogger().lifecycle("build has ended on on pod " + podName + " (" + podNumber + "/" + numberOfPods + ") with result " + resCode + " , gathering results"); Collection binaryResults = downloadTestXmlFromPod(namespace, createdPod); - getLogger().lifecycle("removing pod " + podName + " (" + podIdx + "/" + numberOfPods + ") after completed build"); + getLogger().lifecycle("removing pod " + podName + " (" + podNumber + "/" + numberOfPods + ") after completed build"); - File logFileToArchive = new File(podLogsDirectory, podName + ".log"); - try (FileInputStream logIn = new FileInputStream(podOutput); FileOutputStream logOut = new FileOutputStream(logFileToArchive)) { - IOUtils.copy(logIn, logOut); - } try (KubernetesClient client = getKubernetesClient()) { client.pods().delete(createdPod); client.persistentVolumeClaims().delete(pvc); @@ -267,7 +265,7 @@ public class KubesTest extends DefaultTask { return new KubePodResult(podIdx, resCode, podOutput, binaryResults); }); } catch (Retry.RetryException e) { - throw new RuntimeException("Failed to build in pod " + podName + " (" + podIdx + "/" + numberOfPods + ") in " + numberOfRetries + " attempts", e); + throw new RuntimeException("Failed to build in pod " + podName + " (" + podNumber + "/" + numberOfPods + ") in " + numberOfRetries + " attempts", e); } }