geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject incubator-geode git commit: GEODE-1666 Add Gradle Docker test plugin for distributedTest
Date Mon, 18 Jul 2016 14:06:59 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-1666 [created] bee501cb2


GEODE-1666 Add Gradle Docker test plugin for distributedTest

- Bump Gradle from 2.12 to 2.14


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/bee501cb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/bee501cb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/bee501cb

Branch: refs/heads/feature/GEODE-1666
Commit: bee501cb2d2392dac8ac18cb914cbb945bf773ae
Parents: 8341267
Author: Jens Deppe <jdeppe@pivotal.io>
Authored: Mon Jul 18 07:01:58 2016 -0700
Committer: Jens Deppe <jdeppe@pivotal.io>
Committed: Mon Jul 18 07:01:58 2016 -0700

----------------------------------------------------------------------
 build.gradle                             |  2 +
 gradle/test.gradle                       | 73 +++++++++++++++++++++++++++
 gradle/wrapper/gradle-wrapper.properties |  2 +-
 3 files changed, 76 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bee501cb/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 9a3ff10..04e685c 100755
--- a/build.gradle
+++ b/build.gradle
@@ -18,12 +18,14 @@
 buildscript {
   repositories {
     maven { url "https://plugins.gradle.org/m2/" }
+    maven { url = "http://dl.bintray.com/pedjak/gradle-plugins"}
   }
 
   dependencies {
     classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.2.0"
     classpath "org.ajoberstar:gradle-git:1.3.2"
     classpath 'com.bmuschko:gradle-nexus-plugin:2.3.1'
+    classpath "com.pedjak.gradle.plugins:dockerized-test:0.4.2"
   }
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bee501cb/gradle/test.gradle
----------------------------------------------------------------------
diff --git a/gradle/test.gradle b/gradle/test.gradle
index 96ea88d..2fdff87 100644
--- a/gradle/test.gradle
+++ b/gradle/test.gradle
@@ -45,6 +45,8 @@ gradle.taskGraph.whenReady({ graph ->
 
 
 subprojects {
+  apply plugin: 'com.github.pedjak.dockerized-test'
+
   dependencies {
     testCompile ('com.github.stefanbirkner:system-rules:' + project.'system-rules.version')
{
       exclude module: 'junit-dep'
@@ -130,6 +132,77 @@ subprojects {
       excludeCategories 'com.gemstone.gemfire.test.junit.categories.FlakyTest'
     }
     forkEvery 30
+
+    maxParallelForks = 20
+
+    docker {
+      // base image for creating docker containers that execute the tests
+      image = 'gemfire/centos7-gradle'
+
+      // volumes mounted to the containers
+      // in a form: host_dir : container_dir
+      def gradleHome = System.getenv("GRADLE_USER_HOME")
+      def pwd = System.getenv("PWD")
+      def java_home = System.getenv("JAVA_HOME")
+      volumes = ["${gradleHome}":gradleHome]
+      volumes << ["${pwd}":pwd]
+
+      // specify the user for starting Gradle test worker
+      // within the container, default to current user
+      // user = 'control'
+
+      argsInspect = { List args ->
+        def javaHomeIdx = 0
+        def i = args.iterator()
+        def j = 0
+        while (i.hasNext()) {
+          if (i.next() == '-e') {
+            def x = i.next()
+            j++
+            if (x.startsWith('JAVA_HOME')) {
+              javaHomeIdx = j
+            }
+          }
+          j++
+        }
+
+        //        if (javaHomeIdx > 0) {
+        //          args.removeAt(javaHomeIdx-1)
+        //          args.removeAt(javaHomeIdx-1)
+        //        }
+
+        // custom args processing and tweaking
+        // of the docker command starting the testworker inside a container
+        // returned args will be used for the final docker container start
+        def javaIdx = 0
+        def javaCmd = ["( ulimit -n 2048; "]
+        args.eachWithIndex { val, idx ->
+          if (val == 'java') {
+            javaIdx = idx
+          }
+          if (javaIdx > 0) {
+            javaCmd << val
+          }
+        }
+
+        if (javaIdx != 0) {
+          javaCmd << ")"
+          args = args.subList(0, javaIdx)
+          args.addAll("/bin/bash", "-c", javaCmd.join(" "))
+        }
+
+        // Infer the index of this invocation
+        def matcher = (args[args.size - 1] =~ /.*Executor (\d*).*/)
+
+        args[3] = args[3] + matcher[0][1]
+        def workdir = new File(args[3])
+        println "--->>> making ${workdir}"
+        workdir.mkdirs()
+        //        println args
+
+        args
+      }
+    }
   }
   
   task flakyTest(type:Test) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/bee501cb/gradle/wrapper/gradle-wrapper.properties
----------------------------------------------------------------------
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index ec27a39..3050eca 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip


Mime
View raw message