You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2018/08/16 06:13:01 UTC

[geode] branch develop updated: GEODE-5579: Add -PforceTest property to :test tasks (#2318)

This is an automated email from the ASF dual-hosted git repository.

jbarrett pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 0283a68  GEODE-5579: Add -PforceTest property to :test tasks (#2318)
0283a68 is described below

commit 0283a68a7cc6e58489d5e78874dbe10d9ca4440e
Author: Patrick Rhomberg <pr...@pivotal.io>
AuthorDate: Wed Aug 15 23:12:56 2018 -0700

    GEODE-5579: Add -PforceTest property to :test tasks (#2318)
    
    * Auto-format whitespace adjustments.
    * Streamline and Unify test facet configuration
    * Separate exclusion of FlakyTest to own configuration block.  *DO* run FlakyTest on UI, Acceptance, and Upgrade tests.
---
 gradle/test.gradle | 104 +++++++++++++++++------------------------------------
 1 file changed, 32 insertions(+), 72 deletions(-)

diff --git a/gradle/test.gradle b/gradle/test.gradle
index bbd31e0..0297c84 100644
--- a/gradle/test.gradle
+++ b/gradle/test.gradle
@@ -28,13 +28,15 @@ task combineReports(type: TestReport) {
 }
 
 gradle.taskGraph.whenReady({ graph ->
-  tasks.getByName('combineReports').reportOn rootProject.subprojects.collect{ it.tasks.withType(Test) }.flatten()
+  tasks.getByName('combineReports').reportOn rootProject.subprojects.collect {
+    it.tasks.withType(Test)
+  }.flatten()
 })
 
 
 subprojects {
   dependencies {
-    testCompile ('com.github.stefanbirkner:system-rules:' + project.'system-rules.version') {
+    testCompile('com.github.stefanbirkner:system-rules:' + project.'system-rules.version') {
       exclude module: 'junit-dep'
     }
     testCompile 'com.google.code.tempus-fugit:tempus-fugit:' + project.'tempus-fugit.version'
@@ -126,82 +128,39 @@ subprojects {
     distributedTestCompile project(":geode-dunit")
   }
 
-  integrationTest {
-    useJUnit {
-      if(project.hasProperty("testCategory")) {
-        includeCategories += project.testCategory
-      }
-      excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
-    }
-
+  configure([integrationTest, distributedTest, performanceTest, acceptanceTest, uiTest,
+             upgradeTest]) {
     forkEvery 1
 
     doFirst {
       TestPropertiesWriter.writeTestProperties(buildDir, name)
     }
-    outputs.upToDateWhen{false}
+    outputs.upToDateWhen { false }
   }
 
-  distributedTest {
+  // Until the category can be removed, we exclude FlakyTest from some targets.
+  configure([integrationTest, distributedTest, performanceTest]) {
     useJUnit {
-      if(project.hasProperty("testCategory")) {
+      if (project.hasProperty("testCategory")) {
         includeCategories += project.testCategory
       }
       excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
     }
-
-    forkEvery 1
-    outputs.upToDateWhen{false}
-  }
-
-  performanceTest {
-    useJUnit {
-      if(project.hasProperty("testCategory")) {
-        includeCategories += project.testCategory
-      }
-      excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
-    }
-
-    forkEvery 1
-  }
-
-  acceptanceTest {
-    useJUnit {
-      if(project.hasProperty("testCategory")) {
-        includeCategories += project.testCategory
-      }
-    }
-    forkEvery 1
-    outputs.upToDateWhen{false}
   }
 
-  uiTest {
-    useJUnit {
-      if(project.hasProperty("testCategory")) {
-        includeCategories += project.testCategory
-      }
+  if (project.hasProperty("forceTest")) {
+    // All test facets already force rerun.  Only :test can be upToDate.
+    test {
+      outputs.upToDateWhen { false }
     }
-    forkEvery 1
-    outputs.upToDateWhen{false}
   }
 
-  upgradeTest {
-    useJUnit {
-      if(project.hasProperty("testCategory")) {
-        includeCategories += project.testCategory
-      }
-    }
-    forkEvery 1
-    outputs.upToDateWhen{false}
-  }
-
-
-  task repeatTest(type:RepeatTest) {
-    times= Integer.parseInt(repeat)
+  task repeatTest(type: RepeatTest) {
+    times = Integer.parseInt(repeat)
 
     useJUnit {}
 
-    outputs.upToDateWhen{false}
+    outputs.upToDateWhen { false }
 
     classpath += project.sourceSets.distributedTest.runtimeClasspath
     testClassesDirs += project.sourceSets.distributedTest.output.classesDirs
@@ -212,16 +171,16 @@ subprojects {
     classpath += project.sourceSets.acceptanceTest.runtimeClasspath
     testClassesDirs += project.sourceSets.acceptanceTest.output.classesDirs
 
-    if(project.hasProperty("failOnNoMatchingTests")) {
+    if (project.hasProperty("failOnNoMatchingTests")) {
       filter {
         setFailOnNoMatchingTests(Boolean.valueOf(project.failOnNoMatchingTests))
       }
     }
   }
 
-  task flakyTest(type:Test) {
+  task flakyTest(type: Test) {
     useJUnit {
-      if(project.hasProperty("testCategory")) {
+      if (project.hasProperty("testCategory")) {
         includeCategories += project.testCategory
       }
       includeCategories += 'org.apache.geode.test.junit.categories.FlakyTest'
@@ -233,7 +192,7 @@ subprojects {
     }
 
     reports.junitXml.destination = file "$buildDir/test-reports-flaky"
-    outputs.upToDateWhen{false}
+    outputs.upToDateWhen { false }
   }
 
   /*
@@ -245,7 +204,6 @@ subprojects {
    *
   */
 
-
   // By proving a file with an arbitrary list of test classes, we can select only those
   // tests to run. Activated using -Dcustom.tests=<file> customTest
   def customTestList = []
@@ -254,20 +212,20 @@ subprojects {
     new File(customTestFile).eachLine { customTestList << it }
   }
 
-  task customTest(type:Test) {
+  task customTest(type: Test) {
     include { x ->
-      (x.isDirectory() || customTestList.any { y -> x.getName().contains(y) } ) ? true : false
+      (x.isDirectory() || customTestList.any { y -> x.getName().contains(y) }) ? true : false
     }
 
     forkEvery 30
   }
 
   // apply common test configuration
-  gradle.taskGraph.whenReady( { graph ->
+  gradle.taskGraph.whenReady({ graph ->
     tasks.withType(Test).each { test ->
       check.dependsOn test
       test.configure {
-        onlyIf { ! Boolean.getBoolean('skip.tests') }
+        onlyIf { !Boolean.getBoolean('skip.tests') }
 
         def resultsDir = TestPropertiesWriter.testResultsDir(buildDir, test.name)
         test.workingDir = resultsDir
@@ -280,8 +238,8 @@ subprojects {
         maxHeapSize '768m'
 //        jvmArgs = ['-XX:+HeapDumpOnOutOfMemoryError', '-ea',"-XX:+PrintGC", "-XX:+PrintGCDetails","-XX:+PrintGCTimeStamps"]
         jvmArgs = ['-XX:+HeapDumpOnOutOfMemoryError', '-ea']
-        if(!testJVM.trim().isEmpty()) {
-          executable="${testJVM}/bin/java"
+        if (!testJVM.trim().isEmpty()) {
+          executable = "${testJVM}/bin/java"
         }
 
         systemProperty 'gemfire.DEFAULT_MAX_OPLOG_SIZE', '10'
@@ -298,7 +256,7 @@ subprojects {
 
         // The distributed tests seem to need to use /tmp directly,
         // so exclude them from using the supplied temp directory.
-        if (! test.name.contains("distributed")) {
+        if (!test.name.contains("distributed")) {
           systemProperty 'java.io.tmpdir', System.getProperty('java.io.tmpdir')
         }
 
@@ -322,12 +280,14 @@ subprojects {
   })
 
   // Make precheckin task run all validation tests for checking in code.
-  task precheckin (dependsOn: [ build, acceptanceTest, integrationTest, distributedTest, upgradeTest ]) {
+  task precheckin(dependsOn: [build, acceptanceTest, integrationTest, distributedTest, upgradeTest]) {
     description 'Run this task before checking in code to validate changes. It runs tests beyond unitTest'
   }
 
   combineReports.mustRunAfter check, test, integrationTest, distributedTest, flakyTest, acceptanceTest, repeatTest, upgradeTest
-  [build, check, test, integrationTest, distributedTest, flakyTest, acceptanceTest, repeatTest, upgradeTest].each {it.finalizedBy combineReports}
+  [build, check, test, integrationTest, distributedTest, flakyTest, acceptanceTest, repeatTest, upgradeTest].each {
+    it.finalizedBy combineReports
+  }
 }
 
 classes.dependsOn subprojects.compileIntegrationTestJava