From 948898577548507b9c371d1c3584ba71d28aaaae Mon Sep 17 00:00:00 2001 From: Ryan Ernst Date: Thu, 9 Mar 2017 11:56:43 -0800 Subject: [PATCH] Test: Upgrade randomized runner to 2.5.0 (#23513) This commit upgrades to the newest version of randomized runner. There is a new additional check that allows ensuring the working directory for each child jvm is empty. By default, this check will fail the test run. However, for elasticsearch, we default to wipe the directory. For example, if you previously told the runner to not wipe the directory, in order to investigate a failure, the wipe option will delete this data upon re-running the test. --- .../carrotsearch/gradle/junit4/RandomizedTestingTask.groovy | 5 +++++ .../main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy | 1 + buildSrc/version.properties | 2 +- .../org/elasticsearch/bootstrap/test-framework.policy | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy index ecb50ce80b5..8d93301e0c7 100644 --- a/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy +++ b/buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy @@ -67,6 +67,10 @@ class RandomizedTestingTask extends DefaultTask implements ProgressLoggerFactory @Input String ifNoTests = 'ignore' + @Optional + @Input + String onNonEmptyWorkDirectory = 'fail' + TestLoggingConfiguration testLoggingConfig = new TestLoggingConfiguration() BalancersConfiguration balancersConfig = new BalancersConfiguration(task: this) @@ -193,6 +197,7 @@ class RandomizedTestingTask extends DefaultTask implements ProgressLoggerFactory shuffleOnSlave: shuffleOnSlave, leaveTemporary: leaveTemporary, ifNoTests: ifNoTests, + onNonEmptyWorkDirectory: onNonEmptyWorkDirectory, newenvironment: true ] diff --git a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy index e27f041aaab..5e58bcc7878 100644 --- a/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy +++ b/buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy @@ -476,6 +476,7 @@ class BuildPlugin implements Plugin { jvm "${project.javaHome}/bin/java" parallelism System.getProperty('tests.jvms', 'auto') ifNoTests 'fail' + onNonEmptyWorkDirectory 'wipe' leaveTemporary true // TODO: why are we not passing maxmemory to junit4? diff --git a/buildSrc/version.properties b/buildSrc/version.properties index 1a4c62d2a8a..77157d2f3c8 100644 --- a/buildSrc/version.properties +++ b/buildSrc/version.properties @@ -13,7 +13,7 @@ slf4j = 1.6.2 jna = 4.2.2 # test dependencies -randomizedrunner = 2.4.0 +randomizedrunner = 2.5.0 junit = 4.11 httpclient = 4.5.2 # When updating httpcore, please also update core/src/main/resources/org/elasticsearch/bootstrap/test-framework.policy diff --git a/core/src/main/resources/org/elasticsearch/bootstrap/test-framework.policy b/core/src/main/resources/org/elasticsearch/bootstrap/test-framework.policy index f7654f2dfff..8769c80b84e 100644 --- a/core/src/main/resources/org/elasticsearch/bootstrap/test-framework.policy +++ b/core/src/main/resources/org/elasticsearch/bootstrap/test-framework.policy @@ -42,7 +42,7 @@ grant codeBase "${codebase.lucene-test-framework-6.5.0-snapshot-d00c5ca.jar}" { permission java.lang.RuntimePermission "accessDeclaredMembers"; }; -grant codeBase "${codebase.randomizedtesting-runner-2.4.0.jar}" { +grant codeBase "${codebase.randomizedtesting-runner-2.5.0.jar}" { // optionally needed for access to private test methods (e.g. beforeClass) permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; // needed to fail tests on uncaught exceptions from other threads