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 9902342 GEODE-5488 - Enable docker for all of our gradle tests (#2215)
9902342 is described below
commit 990234297c2b5f0cfccfdfef8387cb8bf8e85a0d
Author: Robert Houghton <[email protected]>
AuthorDate: Fri Jul 27 12:52:24 2018 -0700
GEODE-5488 - Enable docker for all of our gradle tests (#2215)
Integration, Performance, UI, Upgrade, Distributed tests
will all use the dockerized-gradle-plugin as the test executor when
enabled via gradle property.
Co-authored-by: Dick Cavender <[email protected]>
Co-authored-by: Patrick Rhomberg <[email protected]>
Co-authored-by: Robert Houghton <[email protected]>
---
build.gradle | 6 +-
ci/scripts/test-run.sh | 159 --------------------------
gradle/docker.gradle | 11 ++
gradle/test-by-category.gradle | 252 +++++++++++++++++++++++++++++++++++++++++
gradle/test.gradle | 6 +-
5 files changed, 269 insertions(+), 165 deletions(-)
diff --git a/build.gradle b/build.gradle
index df7a04c..a111eac 100755
--- a/build.gradle
+++ b/build.gradle
@@ -82,16 +82,12 @@ if (name == 'geode') {
ext.scriptDir = 'gradle'
}
-if (project.hasProperty('parallelDunit')) {
- def pwd = System.getenv('PWD')
- def geodeDir = new File(pwd).getCanonicalPath()
- ext.dunitDockerVolumes = ["${geodeDir}":geodeDir]
-}
apply from: "${scriptDir}/utilities.gradle"
apply from: "${scriptDir}/java.gradle"
apply from: "${scriptDir}/dependency-resolution.gradle"
apply from: "${scriptDir}/test.gradle"
+apply from: "${scriptDir}/test-by-category.gradle"
apply from: "${scriptDir}/publish.gradle"
apply from: "${scriptDir}/code-analysis.gradle"
apply from: "${scriptDir}/sonar.gradle"
diff --git a/ci/scripts/test-run.sh b/ci/scripts/test-run.sh
deleted file mode 100755
index 887e211..0000000
--- a/ci/scripts/test-run.sh
+++ /dev/null
@@ -1,159 +0,0 @@
-#!/usr/local/bin/tini-wrapper /bin/bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -e
-
-export TERM=${TERM:-dumb}
-export BUILDROOT=$(pwd)
-export DEST_DIR=${BUILDROOT}/built-geode
-export GRADLE_TASK=${1}
-export BASE_FILENAME=${2}
-export TMPDIR=${DEST_DIR}/tmp
-export GEODE_BUILD=${DEST_DIR}/test
-export GEODE_BUILD_VERSION_NUMBER=$(grep "versionNumber *="
geode/gradle.properties | awk -F "=" '{print $2}' | tr -d ' ')
-
-GEODE_BUILD_VERSION_FILE=${BUILDROOT}/geode-build-version/number
-GEODE_PULL_REQUEST_ID_FILE=${BUILDROOT}/geode/.git/id
-if [ -e "${GEODE_PULL_REQUEST_ID_FILE}" ]; then
- GEODE_PULL_REQUEST_ID=$(cat ${GEODE_PULL_REQUEST_ID_FILE})
-fi
-
-if [ ! -e "${GEODE_BUILD_VERSION_FILE}" ] && [ -z "${GEODE_PULL_REQUEST_ID}"
]; then
- echo "${GEODE_BUILD_VERSION_FILE} file does not exist. Concourse is probably
not configured correctly."
- exit 1
-fi
-if [ -z ${MAINTENANCE_VERSION+x} ]; then
- echo "MAINTENANCE_VERSION is unset. Check your pipeline configuration and
make sure this script is called properly."
- exit 1
-fi
-
-EMAIL_SUBJECT="${BUILDROOT}/built-geode/subject"
-EMAIL_BODY="${BUILDROOT}/built-geode/body"
-
-echo "Geode unit tests '\${BUILD_PIPELINE_NAME}/\${BUILD_JOB_NAME}' took too
long to execute" > $EMAIL_SUBJECT
-echo "Pipeline results can be found at:" >$EMAIL_BODY
-echo "" >>$EMAIL_BODY
-echo "Concourse:
\${ATC_EXTERNAL_URL}/teams/\${BUILD_TEAM_NAME}/pipelines/\${BUILD_PIPELINE_NAME}/jobs/\${BUILD_JOB_NAME}/builds/\${BUILD_NAME}"
>>$EMAIL_BODY
-echo "" >>$EMAIL_BODY
-
-# Called by trap when the script is exiting
-function error_exit() {
- echo "Geode unit tests completed in
'\${BUILD_PIPELINE_NAME}/\${BUILD_JOB_NAME}' with non-zero exit code" >
$EMAIL_SUBJECT
- echo "Pipeline results can be found at:" >$EMAIL_BODY
- echo "" >>$EMAIL_BODY
- echo "Concourse:
\${ATC_EXTERNAL_URL}/teams/\${BUILD_TEAM_NAME}/pipelines/\${BUILD_PIPELINE_NAME}/jobs/\${BUILD_JOB_NAME}/builds/\${BUILD_NAME}"
>>$EMAIL_BODY
- echo "" >>$EMAIL_BODY
-}
-
-trap error_exit ERR
-if [ -z "${GEODE_PULL_REQUEST_ID}" ]; then
- CONCOURSE_VERSION=$(cat ${GEODE_BUILD_VERSION_FILE})
- CONCOURSE_PRODUCT_VERSION=${CONCOURSE_VERSION%%-*}
- GEODE_PRODUCT_VERSION=${GEODE_BUILD_VERSION_NUMBER}
- CONCOURSE_BUILD_SLUG=${CONCOURSE_VERSION##*-}
- BUILD_ID=${CONCOURSE_VERSION##*.}
- FULL_PRODUCT_VERSION=${GEODE_PRODUCT_VERSION}-${CONCOURSE_BUILD_SLUG}
- echo "Concourse VERSION is ${CONCOURSE_VERSION}"
- echo "Product VERSION is ${FULL_PRODUCT_VERSION}"
- echo "Build ID is ${BUILD_ID}"
-else
- FULL_PRODUCT_VERSION="geode-pr-${GEODE_PULL_REQUEST_ID}"
-fi
-
-printf "\nUsing the following JDK:"
-java -version
-printf "\n\n"
-
-directories_file=${DEST_DIR}/artifact_directories
-mkdir -p ${TMPDIR}
-
-echo "TMPDIR = ${TMPDIR}"
-echo "GRADLE_TASK = ${GRADLE_TASK}"
-echo "BASE_FILENAME = ${BASE_FILENAME}"
-
-DOCKER_RESOURCE="docker-geode-build-image"
-DOCKER_PIDFILE="/var/run/docker.pid"
-
-if [ -e ${DOCKER_RESOURCE}/rootfs.tar ]; then
- if [ -e /usr/local/bin/initdocker ]; then
- echo "Initializing Docker environment..."
- /usr/local/bin/initdocker || true
-
- # Stuff like ENV settings don't automatically get imported
- CHANGE=()
- for i in $(jq -r '.env | .[]' ${DOCKER_RESOURCE}/metadata.json); do
- CHANGE+=( $(echo "$i" | awk -F= '{printf("--change \"ENV %s %s\"", $1,
$2)}') )
- done
-
- REPO=$(cat ${DOCKER_RESOURCE}/repository)
- echo "Importing Docker image..."
- eval "docker import ${CHANGE[@]} ${DOCKER_RESOURCE}/rootfs.tar $REPO"
- DUNIT_DOCKER_IMAGE="-PdunitDockerImage=${REPO}"
- echo "Docker initialization complete."
- fi
-fi
-
-DEFAULT_GRADLE_TASK_OPTIONS="--no-daemon -x javadoc -x spotlessCheck"
-
-mkdir -p ${GEODE_BUILD}
-if [ -v CALL_STACK_TIMEOUT ]; then
- geode-ci/ci/scripts/capture-call-stacks.sh ${CALL_STACK_TIMEOUT} &
-fi
-
-pushd geode
- tar cf - * | (cd ${GEODE_BUILD}; tar xpf -)
-popd
-
-export FILENAME=${BASE_FILENAME}-${FULL_PRODUCT_VERSION}.tgz
-
-if [[ -n "${PARALLEL_DUNIT}" && "${PARALLEL_DUNIT}" == "true" ]]; then
- PARALLEL_DUNIT="-PparallelDunit"
- if [ -n "${DUNIT_PARALLEL_FORKS}" ]; then
- DUNIT_PARALLEL_FORKS="-PdunitParallelForks=${DUNIT_PARALLEL_FORKS}"
- fi
-else
- PARALLEL_DUNIT=""
- DUNIT_PARALLEL_FORKS=""
-fi
-
-pushd ${GEODE_BUILD}
- set +e
- echo "Running tests"
- set -x
-# ./gradlew --no-daemon -x javadoc -x spotlessCheck
:geode-assembly:acceptanceTest --tests
org.apache.geode.management.internal.cli.commands.PutCommandWithJsonTest
- ./gradlew ${PARALLEL_DUNIT} ${DUNIT_PARALLEL_FORKS} ${DUNIT_DOCKER_IMAGE} \
- --system-prop "java.io.tmpdir=${TMPDIR}" ${DEFAULT_GRADLE_TASK_OPTIONS}
${GRADLE_TASK_OPTIONS} ${GRADLE_TASK}
- export GRADLE_EXIT_STATUS=$?
- set +x
-popd
-
-echo "*************************************************************"
-echo "Results information is located in the 'archive-results' task"
-echo "*************************************************************"
-
-echo "GRADLE_EXIT_STATUS is ${GRADLE_EXIT_STATUS}"
-
-
-if [ -e ${DOCKER_PIDFILE} ]; then
- kill $(cat ${DOCKER_PIDFILE})
-fi
-
-if [[ "${GRADLE_EXIT_STATUS}" != "0" && "${GRADLE_TASK}" == "test" ]]; then
- error_exit
-fi
-exit ${GRADLE_EXIT_STATUS}
diff --git a/gradle/docker.gradle b/gradle/docker.gradle
index c0f2815..ec08ab7 100644
--- a/gradle/docker.gradle
+++ b/gradle/docker.gradle
@@ -38,6 +38,13 @@
* The default is 'root'.
*/
+
+if (project.hasProperty('parallelDunit')) {
+ def pwd = System.getenv('PWD')
+ def geodeDir = new File(pwd).getCanonicalPath()
+ ext.dunitDockerVolumes = ["${geodeDir}":geodeDir]
+}
+
def dockerConfig = {
maxParallelForks = dunitParallelForks.toInteger()
@@ -110,5 +117,9 @@ subprojects {
distributedTest.configure(dockerConfig)
upgradeTest.configure(dockerConfig)
repeatTest.configure(dockerConfig)
+ integrationTest.configure(dockerConfig)
+// ACCEPTANCE TEST NEEDS DOCKER-COMPOSE TO WORK WITHIN DOCKER FIRST
+// acceptanceTest.configure(dockerConfig)
+ uiTest.configure(dockerConfig)
}
}
diff --git a/gradle/test-by-category.gradle b/gradle/test-by-category.gradle
new file mode 100644
index 0000000..02268f1
--- /dev/null
+++ b/gradle/test-by-category.gradle
@@ -0,0 +1,252 @@
+import org.apache.geode.gradle.TestPropertiesWriter
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+subprojects {
+ dependencies {
+ 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'
+ testCompile 'org.awaitility:awaitility:' + project.'awaitility.version'
+ testCompile 'edu.umd.cs.mtc:multithreadedtc:' +
project.'multithreadedtc.version'
+ testCompile 'eu.codearte.catch-exception:catch-exception:' +
project.'catch-exception.version'
+ testCompile 'eu.codearte.catch-exception:catch-throwable:' +
project.'catch-throwable.version'
+ testCompile 'junit:junit:' + project.'junit.version'
+ testCompile 'org.assertj:assertj-core:' + project.'assertj-core.version'
+ testCompile 'org.hamcrest:hamcrest-all:' + project.'hamcrest-all.version'
+ testCompile 'org.jmock:jmock-junit4:' + project.'jmock.version'
+ testCompile 'org.jmock:jmock-legacy:' + project.'jmock.version'
+
+ testCompile 'org.mockito:mockito-core:' + project.'mockito-core.version'
+ testCompile 'org.powermock:powermock-core:' + project.'powermock.version'
+ testCompile 'org.powermock:powermock-module-junit4:' +
project.'powermock.version'
+ testCompile 'org.powermock:powermock-api-mockito2:' +
project.'powermock.version'
+
+ testCompile 'pl.pragmatists:JUnitParams:' + project.'JUnitParams.version'
+
+ testRuntime 'cglib:cglib:' + project.'cglib.version'
+ }
+
+ configurations {
+ apt
+ }
+
+ dependencies {
+ apt files("${rootProject.projectDir}/buildSrc/build/libs/buildSrc.jar")
+ apt(group: 'junit', name: 'junit', version: project.'junit.version') {
+ transitive = false
+ }
+ // Because EnsureCorrectRunsWithProcessor needs access to
+ // CategoryWithParameterizedRunnerFactory. The specific version of
geode-junit is not important.
+ apt(group: 'org.apache.geode', name: 'geode-junit', version: '1.3.0') {
+ transitive = false
+ }
+ }
+
+ compileTestJava {
+ options.annotationProcessorPath = files(configurations['apt'])
+ }
+
+ test {
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ }
+
+ task securityTest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.SecurityTest'
+ }
+
+ forkEvery 1
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+
+ reports.junitXml.destination = file "$buildDir/test-reports-security"
+ }
+
+ task clientServerTest(type: Test) {
+ useJUnit {
+ includeCategories
'org.apache.geode.test.junit.categories.ClientServerTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file "$buildDir/test-reports-security"
+ }
+
+ task dlockTest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.DLockTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file "$buildDir/test-reports-dlock"
+ }
+
+ task backwardCompatibilityTest(type: Test) {
+ useJUnit {
+ includeCategories
'org.apache.geode.test.junit.categories.BackwardCompatibilityTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file
"$buildDir/test-reports-backwardcompatibility"
+ }
+
+ task clientSubscriptionTest(type: Test) {
+ useJUnit {
+ includeCategories
'org.apache.geode.test.junit.categories.ClientSubscriptionTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file
"$buildDir/test-reports-client-subscription"
+ }
+ task queryTest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.OQLQueryTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file "$buildDir/test-reports-oql-query"
+ }
+
+ task indexTest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.OQLIndexTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file "$buildDir/test-reports-oql-index"
+ }
+
+ task functionServiceTest(type: Test) {
+ useJUnit {
+ includeCategories
'org.apache.geode.test.junit.categories.FunctionServiceTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file
"$buildDir/test-reports-function-service"
+ }
+
+ task membershipTest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.MembershipTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file "$buildDir/test-reports-membership"
+ }
+ task luceneTest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.LuceneTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file "$buildDir/test-reports-lucene"
+ }
+
+ task aeqTest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.AEQTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file "$buildDir/test-reports-aeq"
+ }
+
+
+ task sessionTest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.SessionTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file "$buildDir/test-reports-session"
+ }
+
+ task wanTest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.WanTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file "$buildDir/test-reports-wan"
+ }
+
+
+ task redisTest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.RedisTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ forkEvery 1
+ reports.junitXml.destination = file "$buildDir/test-reports-redis"
+ }
+
+ task restAPITest(type: Test) {
+ useJUnit {
+ includeCategories 'org.apache.geode.test.junit.categories.RestAPITest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ forkEvery 1
+ reports.junitXml.destination = file "$buildDir/test-reports-restAPI"
+ }
+
+ task serializationTest(type: Test) {
+ useJUnit {
+ includeCategories
'org.apache.geode.test.junit.categories.SerializationTest'
+ excludeCategories 'org.apache.geode.test.junit.categories.FlakyTest'
+ }
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
+ reports.junitXml.destination = file "$buildDir/test-reports-serialization"
+ }
+}
\ No newline at end of file
diff --git a/gradle/test.gradle b/gradle/test.gradle
index 4605697..6dd96f7 100644
--- a/gradle/test.gradle
+++ b/gradle/test.gradle
@@ -134,7 +134,7 @@ subprojects {
outputs.upToDateWhen{false}
}
- distributedTest {
+ performanceTest {
useJUnit {
if(project.hasProperty("testCategory")) {
includeCategories += project.testCategory
@@ -143,6 +143,10 @@ subprojects {
}
forkEvery 1
+
+ doFirst {
+ TestPropertiesWriter.writeTestProperties(buildDir, name)
+ }
outputs.upToDateWhen{false}
}