You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2019/10/13 06:11:37 UTC
[skywalking] branch master updated: [CI] Make e2e more friendly for
local test (#3606)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git
The following commit(s) were added to refs/heads/master by this push:
new ff0e67e [CI] Make e2e more friendly for local test (#3606)
ff0e67e is described below
commit ff0e67e59558c7070fe09c093205945d92485447
Author: kezhenxu94 <ke...@apache.org>
AuthorDate: Sun Oct 13 14:11:30 2019 +0800
[CI] Make e2e more friendly for local test (#3606)
And group the test cases according to their consuming time
---
Jenkinsfile-E2E | 46 ++++++++++---------
test/e2e/e2e-agent-reboot/pom.xml | 12 ++---
test/e2e/e2e-cluster/test-runner/pom.xml | 4 +-
test/e2e/e2e-single-service/pom.xml | 8 +---
test/e2e/e2e-ttl/e2e-ttl-es/pom.xml | 12 ++---
test/e2e/run.sh | 78 ++++++++++++++++++++++++++++++++
6 files changed, 111 insertions(+), 49 deletions(-)
diff --git a/Jenkinsfile-E2E b/Jenkinsfile-E2E
index 6abe4cd..c044871 100755
--- a/Jenkinsfile-E2E
+++ b/Jenkinsfile-E2E
@@ -50,12 +50,6 @@ pipeline {
// thus save unnecessary E2E builds(which is expensive)
sh './mvnw checkstyle:check apache-rat:check'
sh './mvnw -Dcheckstyle.skip -Drat.skip -T2 -Dmaven.compile.fork -Dmaven.compiler.maxmem=3072 -DskipTests clean install'
- // Some of the tests will modify files in the distribution folder, e.g. cluster test will modify the application.yml
- // so we give each test a separate distribution folder here
- sh 'mkdir -p dist-for-single-node-service && tar -zxf dist/apache-skywalking-apm-bin.tar.gz -C dist-for-single-node-service'
- sh 'mkdir -p dist-for-cluster && tar -zxf dist/apache-skywalking-apm-bin.tar.gz -C dist-for-cluster'
- sh 'mkdir -p dist-for-agent-reboot && tar -zxf dist/apache-skywalking-apm-bin.tar.gz -C dist-for-agent-reboot'
- sh 'mkdir -p dist-for-ttl-es && tar -zxf dist/apache-skywalking-apm-bin.tar.gz -C dist-for-ttl-es'
}
}
@@ -67,27 +61,35 @@ pipeline {
stage('Run End-to-End Tests') {
parallel {
- stage('Run Single Node Tests') {
- steps {
- sh './mvnw -Dbuild.id=${BUILD_ID} -f test/e2e/pom.xml -pl e2e-single-service -am verify'
- }
- }
+ stage('Group 1') {
+ stages {
+ stage('Single Node Tests') {
+ steps {
+ sh 'bash -x test/e2e/run.sh e2e-single-service'
+ }
+ }
- stage('Run Cluster Tests (ES/ZK)') {
- steps {
- sh './mvnw -Dbuild.id=${BUILD_ID} -f test/e2e/pom.xml -pl e2e-cluster/test-runner -am verify'
+ stage('Agent Reboot Tests') {
+ steps {
+ sh 'bash -x test/e2e/run.sh e2e-agent-reboot'
+ }
+ }
}
}
- stage('Run Agent Reboot Tests') {
- steps {
- sh './mvnw -Dbuild.id=${BUILD_ID} -f test/e2e/pom.xml -pl e2e-agent-reboot -am verify'
- }
- }
+ stage('Group 2') {
+ stages {
+ stage('Cluster Tests (ES6/ZK)') {
+ steps {
+ sh 'bash -x test/e2e/run.sh e2e-cluster/test-runner'
+ }
+ }
- stage('Run TTL Tests') {
- steps {
- sh './mvnw -Dbuild.id=${BUILD_ID} -f test/e2e/pom.xml -pl e2e-ttl/e2e-ttl-es -am verify'
+ stage('TTL ES Tests') {
+ steps {
+ sh 'bash -x test/e2e/run.sh e2e-ttl/e2e-ttl-es'
+ }
+ }
}
}
}
diff --git a/test/e2e/e2e-agent-reboot/pom.xml b/test/e2e/e2e-agent-reboot/pom.xml
index ddce2ed..65e3f9e 100755
--- a/test/e2e/e2e-agent-reboot/pom.xml
+++ b/test/e2e/e2e-agent-reboot/pom.xml
@@ -93,15 +93,9 @@
</ports>
<volumes>
<bind>
- <volume>
- ${project.basedir}/../../../dist-for-agent-reboot/apache-skywalking-apm-bin:/sw
- </volume>
- <volume>
- ${project.build.directory}:/home
- </volume>
- <volume>
- ${project.basedir}/src/docker/rc.d:/rc.d:ro
- </volume>
+ <volume>${sw.home}:/sw</volume>
+ <volume>${project.build.directory}:/home</volume>
+ <volume>${project.basedir}/src/docker/rc.d:/rc.d:ro</volume>
</bind>
</volumes>
<wait>
diff --git a/test/e2e/e2e-cluster/test-runner/pom.xml b/test/e2e/e2e-cluster/test-runner/pom.xml
index 38c7d36..d4410d4 100755
--- a/test/e2e/e2e-cluster/test-runner/pom.xml
+++ b/test/e2e/e2e-cluster/test-runner/pom.xml
@@ -159,9 +159,7 @@
</links>
<volumes>
<bind>
- <volume>
- ../../../../dist-for-cluster/apache-skywalking-apm-bin:/sw
- </volume>
+ <volume>${sw.home}:/sw</volume>
<volume>
../${gateway.name}/target/${gateway.name}-${project.version}.jar:/home/${gateway.name}-${project.version}.jar
</volume>
diff --git a/test/e2e/e2e-single-service/pom.xml b/test/e2e/e2e-single-service/pom.xml
index 99fe956..d356d7d 100755
--- a/test/e2e/e2e-single-service/pom.xml
+++ b/test/e2e/e2e-single-service/pom.xml
@@ -91,12 +91,8 @@
</ports>
<volumes>
<bind>
- <volume>
- ${project.basedir}/../../../dist-for-single-node-service/apache-skywalking-apm-bin:/skywalking
- </volume>
- <volume>
- ${project.build.directory}:/home
- </volume>
+ <volume>${sw.home}:/skywalking</volume>
+ <volume>${project.build.directory}:/home</volume>
</bind>
</volumes>
<wait>
diff --git a/test/e2e/e2e-ttl/e2e-ttl-es/pom.xml b/test/e2e/e2e-ttl/e2e-ttl-es/pom.xml
index ab0480f..7d95524 100644
--- a/test/e2e/e2e-ttl/e2e-ttl-es/pom.xml
+++ b/test/e2e/e2e-ttl/e2e-ttl-es/pom.xml
@@ -114,15 +114,9 @@
</links>
<volumes>
<bind>
- <volume>
- ../../../../${e2e.dist.directory}/apache-skywalking-apm-bin:/sw
- </volume>
- <volume>
- ${project.basedir}/src/docker/rc.d:/rc.d:ro
- </volume>
- <volume>
- ${project.basedir}/src/docker/es_storage.awk:/es_storage.awk
- </volume>
+ <volume>${sw.home}:/sw</volume>
+ <volume>${project.basedir}/src/docker/rc.d:/rc.d:ro</volume>
+ <volume>${project.basedir}/src/docker/es_storage.awk:/es_storage.awk</volume>
</bind>
</volumes>
<wait>
diff --git a/test/e2e/run.sh b/test/e2e/run.sh
new file mode 100755
index 0000000..822f85b
--- /dev/null
+++ b/test/e2e/run.sh
@@ -0,0 +1,78 @@
+#!/usr/bin/env 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.
+
+export MAVEN_OPTS='-Dmaven.repo.local=.m2/repository -XX:+TieredCompilation -XX:TieredStopAtLevel=1 -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:-UseGCOverheadLimit -Xmx3g'
+
+base_dir=$(pwd)
+build=0
+fast_fail=0
+cases=()
+
+# Parse the arguments
+# --build-dist: build the distribution package ignoring the existance of `dist` folder, useful when running e2e locally
+# --fast-fail: when testing multiple cases, skip following cases when a previous one failed
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --build)
+ build=1
+ ;;
+ --fast-fail)
+ fast_fail=1
+ ;;
+ *)
+ cases+=($1)
+ esac
+ shift
+done
+
+[ ! -f "$base_dir/mvnw" ] \
+ && echo 'Please run run.sh in the root directory of SkyWalking' \
+ && exit 1
+
+[ ${#cases[@]} -le 0 ] \
+ && echo 'Usage: sh test/e2e/run.sh [--build-dist] [--fast-fail] <case1 maven module>[<case2 maven module>...<caseN maven module>]' \
+ && exit 1
+
+[ $build -eq 1 ] \
+ && echo 'Building distribution package...' \
+ && ./mvnw -q -Dcheckstyle.skip -Drat.skip -T2 -Dmaven.compile.fork -DskipTests clean install
+
+echo "Running cases: $(IFS=$' '; echo "${cases[*]}")"
+
+for test_case in "${cases[@]}"
+do
+ echo "Running case: $test_case"
+
+ [ -d "$base_dir/$test_case" ] && rm -rf "$base_dir/$test_case"
+
+ # Some of the tests will modify files in the distribution folder, e.g. cluster test will modify the application.yml
+ # so we give each test a separate distribution folder here
+ mkdir -p "$test_case" && tar -zxf dist/apache-skywalking-apm-bin.tar.gz -C "$test_case"
+
+ ./mvnw -Dbuild.id="${BUILD_ID:-local}" -Dsw.home="${base_dir}/$test_case/apache-skywalking-apm-bin" -f test/e2e/pom.xml -pl "$test_case" -am verify
+
+ status_code=$?
+
+ [ $status_code -ne 0 ] \
+ && [ $fast_fail -eq 1 ] \
+ && echo "Fast failing due to previous failure: $test_case, exit status code: $status_code" \
+ && exit $status_code
+done
+
+exit 0