From 4a7a9a56be4d30f2ad0bdcc57ce3dc3bca523e63 Mon Sep 17 00:00:00 2001 From: Barry Date: Mon, 4 Nov 2019 17:37:43 +0000 Subject: [PATCH] TM-80 Do not publish the junit zip file to Artifactory automatically. (#5667) This functionality was only in place for debugging purposes, to switch it back on, set -Dpublish.junit=true in the Jenkinsfile. --- .../src/main/groovy/net/corda/testing/Properties.java | 4 ++++ .../groovy/net/corda/testing/TestDurationArtifacts.java | 9 +++++---- .../test/groovy/net/corda/testing/PropertiesTest.java | 7 +++++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/buildSrc/src/main/groovy/net/corda/testing/Properties.java b/buildSrc/src/main/groovy/net/corda/testing/Properties.java index cb1e6ca628..b8813e787f 100644 --- a/buildSrc/src/main/groovy/net/corda/testing/Properties.java +++ b/buildSrc/src/main/groovy/net/corda/testing/Properties.java @@ -84,4 +84,8 @@ public class Properties { static String getTargetGitBranch() { return getProperty("git.target.branch").replace('/', '-'); } + + static boolean getPublishJunitTests() { + return ! getProperty("publish.junit").isEmpty(); + } } diff --git a/buildSrc/src/main/groovy/net/corda/testing/TestDurationArtifacts.java b/buildSrc/src/main/groovy/net/corda/testing/TestDurationArtifacts.java index 103bae6939..c29809c4e9 100644 --- a/buildSrc/src/main/groovy/net/corda/testing/TestDurationArtifacts.java +++ b/buildSrc/src/main/groovy/net/corda/testing/TestDurationArtifacts.java @@ -204,11 +204,12 @@ public class TestDurationArtifacts { */ @NotNull public static Task createZipTask(@NotNull final Project project, @NotNull final String name, @Nullable final Task task) { - final Task zipJunitTask = createJunitZipTask(project, name); final Task csvTask = createCsvTask(project, name); - csvTask.dependsOn(zipJunitTask); - // For debugging - can be removed - this simply gathers junit xml and uploads them to artifactory - // so that we can inspect them. + + if (Properties.getPublishJunitTests()) { + final Task zipJunitTask = createJunitZipTask(project, name); + csvTask.dependsOn(zipJunitTask); + } if (task != null) { csvTask.dependsOn(task); diff --git a/buildSrc/src/test/groovy/net/corda/testing/PropertiesTest.java b/buildSrc/src/test/groovy/net/corda/testing/PropertiesTest.java index 3d22c320b1..599c5f8d4a 100644 --- a/buildSrc/src/test/groovy/net/corda/testing/PropertiesTest.java +++ b/buildSrc/src/test/groovy/net/corda/testing/PropertiesTest.java @@ -53,4 +53,11 @@ public class PropertiesTest { public void getTargetGitBranch() { Assert.assertEquals(targetBranch, Properties.getTargetGitBranch()); } + + @Test + public void getPublishJunitTests() { + Assert.assertFalse(Properties.getPublishJunitTests()); + System.setProperty("publish.junit", "true"); + Assert.assertTrue(Properties.getPublishJunitTests()); + } } \ No newline at end of file