You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by li...@apache.org on 2020/12/30 07:21:20 UTC

[dubbo-samples] branch master updated: Improve test framework2 (#193)

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

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-samples.git


The following commit(s) were added to refs/heads/master by this push:
     new 1046e8e  Improve test framework2 (#193)
1046e8e is described below

commit 1046e8e76f33c2b066b8106434c6282a422c6894
Author: gongdewei <ky...@qq.com>
AuthorDate: Wed Dec 30 15:21:11 2020 +0800

    Improve test framework2 (#193)
---
 .github/workflows/java-ci.yml                      | 271 +++++++++++++--
 .travis.yml                                        |  31 --
 dubbo-samples-protobuf-json/pom.xml                |   2 +-
 .../sample/protobuf/genericCall/GenericClient.java |   2 +-
 .../apache/dubbo/sample/protobuf/utils/ZkUtil.java |   6 +-
 killall.sh                                         |   4 -
 run-samples-test.sh                                |  43 ---
 test/convert-case.md                               | 378 +++++++++++++++++++++
 test/merge-test-results.sh                         |  44 +++
 test/quick-start_cn.md                             |  31 +-
 test/run-tests.sh                                  |  18 +-
 11 files changed, 692 insertions(+), 138 deletions(-)

diff --git a/.github/workflows/java-ci.yml b/.github/workflows/java-ci.yml
index 1e95e01..ac9382a 100644
--- a/.github/workflows/java-ci.yml
+++ b/.github/workflows/java-ci.yml
@@ -12,6 +12,7 @@ env:
   FORK_COUNT: 2
   FAIL_FAST: 0
   SHOW_ERROR_DETAIL: 1
+  BUILD_OPTS: -U --batch-mode --no-transfer-progress --settings .mvn/settings.xml clean package dependency:copy-dependencies -DskipTests
 
 jobs:
   build:
@@ -31,29 +32,45 @@ jobs:
           java-version: 1.8
       - name: Build with Maven
         run: |
-          ./mvnw  --settings .mvn/settings.xml clean package
+          ./mvnw $BUILD_OPTS
 
   prepare_test:
     runs-on: ubuntu-latest
     env:
-      JOB_COUNT: 6
+      JOB_COUNT: 10
     steps:
       - uses: actions/checkout@v1
       - name: Prepare test list
         run: |
           cd test
           bash ./prepare-test.sh
-      - name: Upload test list result
+      - name: Upload test list
         uses: actions/upload-artifact@v2
         with:
-          name: test-list-result
+          name: test-list
           path: test/jobs
 
+  test_result:
+    needs: [test_job_1, test_job_2, test_job_3, test_job_4, test_job_5, test_job_6, test_job_7, test_job_8, test_job_9, test_job_10]
+    if: always()
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v1
+      - name: Download test result
+        uses: actions/download-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/
+      - name: Merge test result
+        run: ./test/merge-test-results.sh
+
   test_job_1:
     needs: prepare_test
     runs-on: ubuntu-latest
     env:
       TEST_CASE_FILE: jobs/testcases-1.txt
+    strategy:
+      fail-fast: false
     steps:
       - uses: actions/checkout@v1
       - name: Cache local Maven repository
@@ -69,11 +86,11 @@ jobs:
           java-version: 1.8
       - name: Build with Maven
         run: |
-          ./mvnw  --settings .mvn/settings.xml clean package dependency:copy-dependencies -DskipTests
-      - name: Download test list result
+          ./mvnw $BUILD_OPTS
+      - name: Download test list
         uses: actions/download-artifact@v2
         with:
-          name: test-list-result
+          name: test-list
           path: test/jobs/
       - name: Build test image
         run: cd test && bash ./build-test-image.sh
@@ -81,12 +98,20 @@ jobs:
         run: cd test && BUILD=n bash ./run-tests.sh
       - name: Clean images
         run: cd test && bash ./clean-damaged-image.sh
+      - name: Upload test result
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/*-result*
 
   test_job_2:
     needs: prepare_test
     runs-on: ubuntu-latest
     env:
       TEST_CASE_FILE: jobs/testcases-2.txt
+    strategy:
+      fail-fast: false
     steps:
       - uses: actions/checkout@v1
       - name: Cache local Maven repository
@@ -102,11 +127,11 @@ jobs:
           java-version: 1.8
       - name: Build with Maven
         run: |
-          ./mvnw  --settings .mvn/settings.xml clean package dependency:copy-dependencies -DskipTests
-      - name: Download test list result
+          ./mvnw $BUILD_OPTS
+      - name: Download test list
         uses: actions/download-artifact@v2
         with:
-          name: test-list-result
+          name: test-list
           path: test/jobs/
       - name: Build test image
         run: cd test && bash ./build-test-image.sh
@@ -114,12 +139,20 @@ jobs:
         run: cd test && BUILD=n bash ./run-tests.sh
       - name: Clean images
         run: cd test && bash ./clean-damaged-image.sh
+      - name: Upload test result
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/*-result*
 
   test_job_3:
     needs: prepare_test
     runs-on: ubuntu-latest
     env:
       TEST_CASE_FILE: jobs/testcases-3.txt
+    strategy:
+      fail-fast: false
     steps:
       - uses: actions/checkout@v1
       - name: Cache local Maven repository
@@ -135,11 +168,11 @@ jobs:
           java-version: 1.8
       - name: Build with Maven
         run: |
-          ./mvnw  --settings .mvn/settings.xml clean package dependency:copy-dependencies -DskipTests
-      - name: Download test list result
+          ./mvnw $BUILD_OPTS
+      - name: Download test list
         uses: actions/download-artifact@v2
         with:
-          name: test-list-result
+          name: test-list
           path: test/jobs/
       - name: Build test image
         run: cd test && bash ./build-test-image.sh
@@ -147,12 +180,20 @@ jobs:
         run: cd test && BUILD=n bash ./run-tests.sh
       - name: Clean images
         run: cd test && bash ./clean-damaged-image.sh
+      - name: Upload test result
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/*-result*
 
   test_job_4:
     needs: prepare_test
     runs-on: ubuntu-latest
     env:
       TEST_CASE_FILE: jobs/testcases-4.txt
+    strategy:
+      fail-fast: false
     steps:
       - uses: actions/checkout@v1
       - name: Cache local Maven repository
@@ -168,11 +209,11 @@ jobs:
           java-version: 1.8
       - name: Build with Maven
         run: |
-          ./mvnw  --settings .mvn/settings.xml clean package dependency:copy-dependencies -DskipTests
-      - name: Download test list result
+          ./mvnw $BUILD_OPTS
+      - name: Download test list
         uses: actions/download-artifact@v2
         with:
-          name: test-list-result
+          name: test-list
           path: test/jobs/
       - name: Build test image
         run: cd test && bash ./build-test-image.sh
@@ -180,12 +221,20 @@ jobs:
         run: cd test && BUILD=n bash ./run-tests.sh
       - name: Clean images
         run: cd test && bash ./clean-damaged-image.sh
+      - name: Upload test result
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/*-result*
 
   test_job_5:
     needs: prepare_test
     runs-on: ubuntu-latest
     env:
       TEST_CASE_FILE: jobs/testcases-5.txt
+    strategy:
+      fail-fast: false
     steps:
       - uses: actions/checkout@v1
       - name: Cache local Maven repository
@@ -201,11 +250,11 @@ jobs:
           java-version: 1.8
       - name: Build with Maven
         run: |
-          ./mvnw  --settings .mvn/settings.xml clean package dependency:copy-dependencies -DskipTests
-      - name: Download test list result
+          ./mvnw $BUILD_OPTS
+      - name: Download test list
         uses: actions/download-artifact@v2
         with:
-          name: test-list-result
+          name: test-list
           path: test/jobs/
       - name: Build test image
         run: cd test && bash ./build-test-image.sh
@@ -213,12 +262,61 @@ jobs:
         run: cd test && BUILD=n bash ./run-tests.sh
       - name: Clean images
         run: cd test && bash ./clean-damaged-image.sh
+      - name: Upload test result
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/*-result*
 
   test_job_6:
     needs: prepare_test
     runs-on: ubuntu-latest
     env:
       TEST_CASE_FILE: jobs/testcases-6.txt
+    strategy:
+      fail-fast: false
+    steps:
+      - uses: actions/checkout@v1
+      - name: Cache local Maven repository
+        uses: actions/cache@v2
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/test/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-maven-
+      - name: Set up JDK 1.8
+        uses: actions/setup-java@v1
+        with:
+          java-version: 1.8
+      - name: Build with Maven
+        run: |
+          ./mvnw $BUILD_OPTS
+      - name: Download test list
+        uses: actions/download-artifact@v2
+        with:
+          name: test-list
+          path: test/jobs/
+      - name: Build test image
+        run: cd test && bash ./build-test-image.sh
+      - name: Run tests
+        run: cd test && BUILD=n bash ./run-tests.sh
+      - name: Clean images
+        run: cd test && bash ./clean-damaged-image.sh
+      - name: Upload test result
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/*-result*
+
+  test_job_7:
+    needs: prepare_test
+    runs-on: ubuntu-latest
+    env:
+      TEST_CASE_FILE: jobs/testcases-7.txt
+    strategy:
+      fail-fast: false
     steps:
       - uses: actions/checkout@v1
       - name: Cache local Maven repository
@@ -234,11 +332,11 @@ jobs:
           java-version: 1.8
       - name: Build with Maven
         run: |
-          ./mvnw  --settings .mvn/settings.xml clean package dependency:copy-dependencies -DskipTests
-      - name: Download test list result
+          ./mvnw $BUILD_OPTS
+      - name: Download test list
         uses: actions/download-artifact@v2
         with:
-          name: test-list-result
+          name: test-list
           path: test/jobs/
       - name: Build test image
         run: cd test && bash ./build-test-image.sh
@@ -246,3 +344,132 @@ jobs:
         run: cd test && BUILD=n bash ./run-tests.sh
       - name: Clean images
         run: cd test && bash ./clean-damaged-image.sh
+      - name: Upload test result
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/*-result*
+
+  test_job_8:
+    needs: prepare_test
+    runs-on: ubuntu-latest
+    env:
+      TEST_CASE_FILE: jobs/testcases-8.txt
+    strategy:
+      fail-fast: false
+    steps:
+      - uses: actions/checkout@v1
+      - name: Cache local Maven repository
+        uses: actions/cache@v2
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/test/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-maven-
+      - name: Set up JDK 1.8
+        uses: actions/setup-java@v1
+        with:
+          java-version: 1.8
+      - name: Build with Maven
+        run: |
+          ./mvnw $BUILD_OPTS
+      - name: Download test list
+        uses: actions/download-artifact@v2
+        with:
+          name: test-list
+          path: test/jobs/
+      - name: Build test image
+        run: cd test && bash ./build-test-image.sh
+      - name: Run tests
+        run: cd test && BUILD=n bash ./run-tests.sh
+      - name: Clean images
+        run: cd test && bash ./clean-damaged-image.sh
+      - name: Upload test result
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/*-result*
+
+  test_job_9:
+    needs: prepare_test
+    runs-on: ubuntu-latest
+    env:
+      TEST_CASE_FILE: jobs/testcases-9.txt
+    strategy:
+      fail-fast: false
+    steps:
+      - uses: actions/checkout@v1
+      - name: Cache local Maven repository
+        uses: actions/cache@v2
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/test/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-maven-
+      - name: Set up JDK 1.8
+        uses: actions/setup-java@v1
+        with:
+          java-version: 1.8
+      - name: Build with Maven
+        run: |
+          ./mvnw $BUILD_OPTS
+      - name: Download test list
+        uses: actions/download-artifact@v2
+        with:
+          name: test-list
+          path: test/jobs/
+      - name: Build test image
+        run: cd test && bash ./build-test-image.sh
+      - name: Run tests
+        run: cd test && BUILD=n bash ./run-tests.sh
+      - name: Clean images
+        run: cd test && bash ./clean-damaged-image.sh
+      - name: Upload test result
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/*-result*
+
+  test_job_10:
+    needs: prepare_test
+    runs-on: ubuntu-latest
+    env:
+      TEST_CASE_FILE: jobs/testcases-10.txt
+    strategy:
+      fail-fast: false
+    steps:
+      - uses: actions/checkout@v1
+      - name: Cache local Maven repository
+        uses: actions/cache@v2
+        with:
+          path: ~/.m2/repository
+          key: ${{ runner.os }}-maven-${{ hashFiles('**/test/pom.xml') }}
+          restore-keys: |
+            ${{ runner.os }}-maven-
+      - name: Set up JDK 1.8
+        uses: actions/setup-java@v1
+        with:
+          java-version: 1.8
+      - name: Build with Maven
+        run: |
+          ./mvnw $BUILD_OPTS
+      - name: Download test list
+        uses: actions/download-artifact@v2
+        with:
+          name: test-list
+          path: test/jobs/
+      - name: Build test image
+        run: cd test && bash ./build-test-image.sh
+      - name: Run tests
+        run: cd test && BUILD=n bash ./run-tests.sh
+      - name: Clean images
+        run: cd test && bash ./clean-damaged-image.sh
+      - name: Upload test result
+        if: always()
+        uses: actions/upload-artifact@v2
+        with:
+          name: test-result
+          path: test/jobs/*-result*
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 96bcaf3..0000000
--- a/.travis.yml
+++ /dev/null
@@ -1,31 +0,0 @@
-language: java
-
-sudo: false
-
-matrix:
-  include:
-    - jdk: openjdk11
-      env: JAVA_BASE_IMAGE=openjdk:11
-    - jdk: openjdk8
-      env: JAVA_BASE_IMAGE=openjdk:8
-
-cache:
-  directories:
-    - $HOME/.m2
-
-install: true
-
-before_script: 
-  - . .travis/prepare-artifact.sh
-  - cd java
-
-script:
-  - ./mvnw -U --batch-mode --no-transfer-progress --settings .mvn/settings.xml clean install -pl dubbo-maven-address-plugin -Ddubbo.version=${INTERGARTION_TEST_VERSION}
-  - while sleep 8m; do echo "=====[ $SECONDS seconds, buildroot still building... ]====="; done &
-  - travis_wait 30 ./mvnw -fae -U --batch-mode --no-transfer-progress --settings .mvn/settings.xml clean verify -Pdubbo-integration-test -Djava-image.name=${JAVA_BASE_IMAGE} -Ddubbo.version=${INTERGARTION_TEST_VERSION} -Ddocker.showLogs > output.log
-
-after_failure:
-  - tail -n 5000 output.log
-  - curl -i -F randomname=randomname -F file=@output.log https://uguu.se/api.php\?d\=upload-tool
-after_success:
-  - bash <(curl -s https://codecov.io/bash)
diff --git a/dubbo-samples-protobuf-json/pom.xml b/dubbo-samples-protobuf-json/pom.xml
index 7f1b5f5..e4bd739 100644
--- a/dubbo-samples-protobuf-json/pom.xml
+++ b/dubbo-samples-protobuf-json/pom.xml
@@ -17,7 +17,7 @@
     <properties>
         <source.level>1.8</source.level>
         <target.level>1.8</target.level>
-        <dubbo.version>2.7.4.1</dubbo.version>
+        <dubbo.version>2.7.7</dubbo.version>
         <protobuf.java>3.6.0</protobuf.java>
         <maven-compiler-plugin.version>3.7.0</maven-compiler-plugin.version>
         <maven-failsafe-plugin.version>2.21.0</maven-failsafe-plugin.version>
diff --git a/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/main/java/org/apache/dubbo/sample/protobuf/genericCall/GenericClient.java b/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/main/java/org/apache/dubbo/sample/protobuf/genericCall/GenericClient.java
index 1eba4a8..ce02b49 100644
--- a/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/main/java/org/apache/dubbo/sample/protobuf/genericCall/GenericClient.java
+++ b/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/main/java/org/apache/dubbo/sample/protobuf/genericCall/GenericClient.java
@@ -43,7 +43,7 @@ public class GenericClient {
         reference.setApplication(applicationConfig);
 
         reference.setInterface("org.apache.dubbo.sample.protobuf.GoogleProtobufService");
-        reference.setGeneric(Constants.GENERIC_SERIALIZATION_PROTOBUF);
+        reference.setGeneric(CommonConstants.GENERIC_SERIALIZATION_PROTOBUF);
         reference.setRegistry(new RegistryConfig("zookeeper://" + zookeeperHost + ":2181"));
         GenericService genericService = reference.get();
 
diff --git a/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/main/java/org/apache/dubbo/sample/protobuf/utils/ZkUtil.java b/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/main/java/org/apache/dubbo/sample/protobuf/utils/ZkUtil.java
index 18bcb85..8b38c2a 100644
--- a/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/main/java/org/apache/dubbo/sample/protobuf/utils/ZkUtil.java
+++ b/dubbo-samples-protobuf-json/protobuf-json-serialization-demo/src/main/java/org/apache/dubbo/sample/protobuf/utils/ZkUtil.java
@@ -21,7 +21,9 @@ package org.apache.dubbo.sample.protobuf.utils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.retry.ExponentialBackoffRetry;
-import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
+import org.apache.dubbo.metadata.report.identifier.KeyTypeEnum;
+import org.apache.dubbo.metadata.report.identifier.MetadataIdentifier;
+
 import static org.apache.dubbo.common.constants.CommonConstants.PATH_SEPARATOR;
 
 public class ZkUtil {
@@ -44,7 +46,7 @@ public class ZkUtil {
     }
 
     public static String getNodePath(String root, MetadataIdentifier metadataIdentifier) {
-        return toRootDir(root) + metadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.PATH);
+        return toRootDir(root) + metadataIdentifier.getUniqueKey(KeyTypeEnum.PATH);
     }
 
     private static String toRootDir(String root) {
diff --git a/killall.sh b/killall.sh
deleted file mode 100755
index 75ca71d..0000000
--- a/killall.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/usr/bin/env bash
-
-ps ax | grep 'java' | grep 'org.apache.dubbo.samples' | awk '{ print $1 }' | xargs echo
-ps ax | grep 'java' | grep 'org.apache.dubbo.samples' | awk '{ print $1 }' | xargs kill -9
diff --git a/run-samples-test.sh b/run-samples-test.sh
deleted file mode 100755
index 8f25f70..0000000
--- a/run-samples-test.sh
+++ /dev/null
@@ -1,43 +0,0 @@
-allTestFolders=`ls | grep dubbo-samples`
-
-echo "extra params: $*"
-
-allTest=0
-allSuccess=0
-failedTest=()
-
-for testFolder in $allTestFolders
-do
-
-
-echo "Running test for $testFolder"
-
-./mvnw -pl $testFolder $*
-
-testResult=$?
-
-echo "testResult is $testResult for $testFolder"
-allTest=$((allTest + 1))
-
-if [ $testResult == 0 ]
-then
-   allSuccess=$((allSuccess + 1))
-else
-   failedTest+=($testFolder)
-fi
-
-done
-
-
-echo "All test count: $allTest"
-echo "Success test count: $allSuccess"
-
-if [ $allSuccess == $allTest ]
-then
-   echo "All test pass"
-   exit 0
-else
-   echo "Some test fail: ${failedTest[@]}"
-   exit 1
-fi
-
diff --git a/test/convert-case.md b/test/convert-case.md
new file mode 100644
index 0000000..bcfd765
--- /dev/null
+++ b/test/convert-case.md
@@ -0,0 +1,378 @@
+
+## How to convert test cases
+
+下面整理一些常见的修改项
+
+### 如何设置zookeeper地址
+
+某些测试工程在本地开发环境可以正常运行,但在测试框架运行上会出现`zookeeper not connected`错误,原因是在容器网络中运行,访问zookeeper地址发生变化。
+
+本地开发习惯设置zookeeper地址为`127.0.0.1:2181`或`localhost:2181`,这在本地运行是没问题的,但放到容器中就访问不到了。
+因为不同的服务组件在不同的容器内,不能简单通过本地地址来访问,而是要改成通过hostname来访问。
+
+**作为全局的一个约定,zookeeper的地址和端口分别使用系统属性`zookeeper.address`和`zookeeper.port`。**
+
+Provider Application 和Test类中需要检查配置,参考下面的配置方式:
+
+  xml 配置:
+
+  ```
+  <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:${zookeeper.port:2181}"/>
+  ```
+  
+  application.properties配置:
+
+  ```
+  dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:${zookeeper.port:2181}
+  ```
+
+  Java代码中获取zk地址端口:
+  
+  ```
+  String zookeeperHost = System.getProperty("zookeeper.address", "127.0.0.1"); 
+  String zookeeperPort = System.getProperty("zookeeper.port", "2181");
+  ```
+
+除了`registry`,还有其它使用到zookeeper的配置,如`config-center`, `metadata-report` 等。
+
+  
+### 使用2个zookeeper
+
+如果测试案例使用到两个zk,则需要分别定义不同的系统变量,约定如下:
+
+```
+service:
+  zookeeper1:
+    image: zookeeper
+
+  zookeeper2:
+    image: zookeeper
+
+  xxx:
+    systemProps:
+      - zookeeper.address.1=zookeeper1
+      - zookeeper.port.1=2181
+      - zookeeper.address.2=zookeeper2
+      - zookeeper.port.2=2181
+```
+
+代码或者xml配置要分别处理两个zk的address和port,zookeeper.port.2属性为空时,使用2182 ,以便统一本地运行和在容器中运行。
+
+* 本地的两个zk地址为:127.0.0.1:2181, 127.0.0.1:2182
+* 容器中的两个zk地址为:zookeeper1:2181, zookeeper2:2181
+
+如果代码中使用到`ZKTools`,请查找`ZKTools2.java`,可以直接复制使用。`ZKTools2`是使用到2个zk的意思,`ZKTools`就是单个zk,方便查找重用。
+
+```java
+public class ZKTools2 {
+    private static String zookeeperHost1 = System.getProperty("zookeeper.address.1", "127.0.0.1");
+    private static String zookeeperPort1 = System.getProperty("zookeeper.port.1", "2181");
+    private static String zookeeperHost2 = System.getProperty("zookeeper.address.2", "127.0.0.1");
+    private static String zookeeperPort2 = System.getProperty("zookeeper.port.2", "2182");
+
+    public static void setZookeeperServer1(String host, String port) {
+        zookeeperHost1 = host;
+        zookeeperPort1 = port;
+    }
+
+    public static void setZookeeperServer2(String host, String port) {
+        zookeeperHost2 = host;
+        zookeeperPort2 = port;
+    }
+
+    //...
+}
+```
+
+### 删除testcontainers
+
+新的测试框架不需要使用testcontainers,将相关的配置及代码删除掉,并转换为新的case-configuration.yml配置。
+
+删除pom.xml中的依赖:
+
+```xml
+    <dependency>
+        <groupId>org.testcontainers</groupId>
+        <artifactId>testcontainers</artifactId>
+        <version>1.12.3</version>
+        <scope>test</scope>
+    </dependency>
+
+```
+
+删除Java test类中的调用:
+
+```
+import org.testcontainers.containers.FixedHostPortGenericContainer;
+import org.testcontainers.containers.GenericContainer;
+
+@ClassRule
+public static GenericContainer zookeeper = new FixedHostPortGenericContainer("zookeeper:3.4.9")
+        .withFixedExposedPort(2181, 2181);
+
+```
+
+### 转换docker-maven-plugin的容器配置
+
+将<images>配置的内容转换为新的case-configuration.yml。
+
+下面的样例为单服务配置,可以用`app-builtin-zookeeper.yml`模板:
+
+```
+<plugin>
+    <groupId>io.fabric8</groupId>
+    <artifactId>docker-maven-plugin</artifactId>
+    <version>${docker-maven-plugin.version}</version>
+    <configuration>
+        <images>
+            <image>
+                <name>${image.name}</name>
+                <run>
+                    <ports>
+                        <port>${dubbo.port}:${dubbo.port}</port>
+                        <port>${zookeeper.port}:${zookeeper.port}</port>
+                    </ports>
+                    <wait>
+                        <log>dubbo service started</log>
+                    </wait>
+                </run>
+            </image>
+        </images>
+    </configuration>
+</plugin>
+```
+
+下面的样例为provider + 外部zookeeper,可以用`app-external-zookeeper.yml`模板:
+
+```
+<configuration>
+    <images>
+        <image>
+            <name>zookeeper:latest</name>
+            <run>
+                <ports>
+                    <port>${zookeeper.port}:${zookeeper.port}</port>
+                </ports>
+                <wait>
+                    <tcp>
+                        <host>${dubbo-local-address}</host>
+                        <ports>
+                            <port>${zookeeper.port}</port>
+                        </ports>
+                    </tcp>
+                </wait>
+            </run>
+        </image>
+        <image>
+            <name>${image.name}</name>
+            <run>
+                <ports>
+                    <port>${dubbo.port}:${dubbo.port}</port>
+                </ports>
+                <wait>
+                    <log>dubbo service started</log>
+                </wait>
+            </run>
+        </image>
+    </images>
+</configuration>
+```
+
+可能使用了外部docker配置,需要同时将外部docker配置内容也转换掉。
+比如下面的配置使用了`src/main/resources/docker/docker-compose.yml`:
+
+```
+<plugin>
+    <groupId>io.fabric8</groupId>
+    <artifactId>docker-maven-plugin</artifactId>
+    <version>${docker-maven-plugin.version}</version>
+    <configuration>
+        <images>
+            <image>
+                <external>
+                    <type>compose</type>
+                    <basedir>src/main/resources/docker</basedir>
+                    <composeFile>docker-compose.yml</composeFile>
+                </external>
+            </image>
+            ...
+        </images>
+    </configuration>
+</plugin>
+```
+
+
+### Maven配置优化
+
+#### 统一命名的属性
+
+为了满足测试多个Spring版本/Dubbo版本的需求,下面的属性要统一命名,以便测试时通过-D参数指定版本号:
+
+`dubbo.version` : Dubbo版本号,所有dubbo的组件都使用这个属性
+
+`spring.version` : Spring版本号,Spring应用配置此属性
+
+`spring-boot.version` : SpringBoot版本号,SpringBoot应用配置此属性
+
+`junit.version` : Junit 版本号,由于测试框架单独运行testcase,最好是统一的4.12
+
+如果是Spring项目:
+
+```xml
+<properties>
+    <spring.version>4.3.16.RELEASE</spring.version>
+    <dubbo.version>2.7.7</dubbo.version>
+    <junit.version>4.12</junit.version>
+</properties>
+```
+
+如果是SpringBoot项目:
+
+```xml
+<properties>
+    <spring-boot.version>1.5.13.RELEASE</spring-boot.version>
+    <dubbo.version>2.7.7</dubbo.version>
+    <junit.version>4.12</junit.version>
+</properties>
+```
+
+#### 使用dependencyManagement管理依赖版本号
+
+如果是Spring项目:
+
+```xml
+<dependencyManagement>
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-framework-bom</artifactId>
+            <version>${spring.version}</version>
+            <type>pom</type>
+            <scope>import</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-bom</artifactId>
+            <version>${dubbo.version}</version>
+            <type>pom</type>
+            <scope>import</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-dependencies-zookeeper</artifactId>
+            <version>${dubbo.version}</version>
+            <type>pom</type>
+        </dependency>
+    </dependencies>
+</dependencyManagement>
+```
+
+如果是SpringBoot项目:
+
+```xml
+<dependencyManagement>
+    <dependencies>
+        <dependency>
+            <!-- Import dependency management from Spring Boot -->
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-dependencies</artifactId>
+            <version>${spring-boot.version}</version>
+            <type>pom</type>
+            <scope>import</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-bom</artifactId>
+            <version>${dubbo.version}</version>
+            <type>pom</type>
+            <scope>import</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.dubbo</groupId>
+            <artifactId>dubbo-dependencies-zookeeper</artifactId>
+            <version>${dubbo.version}</version>
+            <type>pom</type>
+        </dependency>
+    </dependencies>
+</dependencyManagement>
+```
+
+注意: 将Spring/SpringBoot的bom放到dubbo-bom之前,优先使用Spring/SpringBoot的版本号,避免出现Spring组件版本号不一致的问题。
+
+SpringBoot项目不要导入spring-framework-bom,避免因为传递的spring.version参数导致SpringBoot依赖的Spring版本发生改变。
+
+
+#### 删除不必要版本号属性
+
+使用dependencyManagement管理版本号之后,spring/spring-boot/dubbo的组件不需要配置版本号
+
+如删除`spring-test`的版本号 `spring-test.version`,旧的配置:
+
+```xml
+<dependencies>
+    <dependency>
+        <groupId>org.apache.dubbo</groupId>
+        <artifactId>dubbo</artifactId>
+        <version>${dubbo.version}</version>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-test</artifactId>
+        <version>${spring-test.version}</version>
+        <scope>test</scope>
+    </dependency>
+</dependencies>
+```
+
+新的配置:
+
+```xml
+<dependencies>
+    <dependency>
+        <groupId>org.apache.dubbo</groupId>
+        <artifactId>dubbo</artifactId>
+    </dependency>
+    <dependency>
+        <groupId>org.springframework</groupId>
+        <artifactId>spring-test</artifactId>
+        <scope>test</scope>
+    </dependency>
+</dependencies>
+```
+
+#### zookeeper依赖
+
+使用dubbo-dependencies-zookeeper导入zookeeper相关依赖,而不是分别依赖curator-framework和zookeeper。
+旧的配置:
+
+```xml
+<dependencies>
+    <dependency>	
+        <groupId>org.apache.zookeeper</groupId>	
+        <artifactId>zookeeper</artifactId>	
+        <version>${zookeeper.version}</version>	
+    </dependency>	
+    <dependency>	
+        <groupId>org.apache.curator</groupId>	
+        <artifactId>curator-framework</artifactId>	
+        <version>${curator.version}</version>	
+    </dependency>
+</dependencies>
+```
+
+新的配置:
+
+```xml
+<dependencies>
+    <dependency>
+        <groupId>org.apache.dubbo</groupId>
+        <artifactId>dubbo-dependencies-zookeeper</artifactId>
+        <type>pom</type>
+    </dependency>
+</dependencies>
+```
+
+#### 清理pom.xml
+
+删除dubbo-integration-test profile及多余的properties
+
diff --git a/test/merge-test-results.sh b/test/merge-test-results.sh
new file mode 100755
index 0000000..082a51b
--- /dev/null
+++ b/test/merge-test-results.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+cd $DIR
+
+TEST_SUCCESS="TEST SUCCESS"
+TEST_FAILURE="TEST FAILURE"
+
+echo "All test results:"
+for resultFile in jobs/*result.txt; do
+  echo "$resultFile:"
+  cat $resultFile
+  echo ""
+done
+
+testResultFile=jobs/merged-test-result.txt
+cat jobs/*-result.txt > $testResultFile
+successTest=`grep -c "$TEST_SUCCESS" $testResultFile`
+failedTest=`grep -c "$TEST_FAILURE" $testResultFile`
+totalCount=`grep -c "" $testResultFile`
+
+echo "----------------------------------------------------------"
+echo "All tests count: $totalCount"
+echo "Success tests count: $successTest"
+
+if [ $successTest == $totalCount ]; then
+  if [ $successTest -gt 0 ]; then
+    echo "All tests pass"
+    echo "----------------------------------------------------------"
+    exit 0
+  else
+    echo "None test pass, test fail"
+    echo "----------------------------------------------------------"
+    exit 1
+  fi
+else
+  echo "Exception : some tests fail: $failedTest"
+  echo "----------------------------------------------------------"
+  echo "Fail tests:"
+  grep "$TEST_FAILURE" jobs/testcases-*-result.txt
+  echo "----------------------------------------------------------"
+  exit 1
+fi
+
diff --git a/test/quick-start_cn.md b/test/quick-start_cn.md
index a494467..f5e82a4 100644
--- a/test/quick-start_cn.md
+++ b/test/quick-start_cn.md
@@ -242,37 +242,10 @@ services:
 ```
 
 
-#### 如何获取zookeeper地址和端口
+#### 转换测试案例
 
-某些测试工程在本地开发环境可以正常运行,但在测试框架运行上会出现`zookeeper not connected`错误,原因是在容器网络中运行,访问zookeeper地址发生变化。
+请参考文档:[How to convert test cases](convert-case.md)
 
-本地开发习惯设置zookeeper地址为`127.0.0.1:2181`或`localhost:2181`,这在本地运行是没问题的,但放到容器中就访问不到了。
-因为不同的服务组件在不同的容器内,不能简单通过本地地址来访问,而是要改成通过hostname来访问。
-
-**作为全局的一个约定,zookeeper的地址和端口分别使用系统属性`zookeeper.address`和`zookeeper.port`。**
-
-Provider Application 和Test类中需要检查配置,参考下面的配置方式:
-
-  xml 配置:
-
-  ```
-  <dubbo:registry address="zookeeper://${zookeeper.address:127.0.0.1}:${zookeeper.port:2181}"/>
-  ```
-  
-  application.properties配置:
-
-  ```
-  dubbo.registry.address=zookeeper://${zookeeper.address:127.0.0.1}:${zookeeper.port:2181}
-  ```
-
-  Java代码中获取zk地址端口:
-  
-  ```
-  String zookeeperHost = System.getProperty("zookeeper.address", "127.0.0.1"); 
-  String zookeeperPort = System.getProperty("zookeeper.port", "2181");
-  ```
-
-除了`registry`,还有其它使用到zookeeper的配置,如
   
 ### 调试运行测试案例
 
diff --git a/test/run-tests.sh b/test/run-tests.sh
index 46f7756..758ab8c 100755
--- a/test/run-tests.sh
+++ b/test/run-tests.sh
@@ -19,9 +19,6 @@ BUILD=${BUILD:-case}
 export BUILD=$BUILD
 echo "BUILD: $BUILD"
 
-#DUBBO_VERSION=
-echo "DUBBO_VERSION: $DUBBO_VERSION"
-
 #debug DEBUG=service1,service2
 export DEBUG=$DEBUG
 echo "DEBUG=$DEBUG"
@@ -96,7 +93,17 @@ testResultFile=${testListFile%.*}-result.txt
 rm -f $testResultFile
 echo "Test results: $testResultFile"
 
-BUILD_OPTS="clean package dependency:copy-dependencies -DskipTests"
+if [ "$DUBBO_VERSION" != "" ];then
+  echo "DUBBO_VERSION: $DUBBO_VERSION"
+fi
+export DUBBO_VERSION=$DUBBO_VERSION
+
+if [ "$MVN_OPTS" != "" ];then
+  echo "MVN_OPTS: $MVN_OPTS"
+fi
+export MVN_OPTS=$MVN_OPTS
+
+BUILD_OPTS="$MVN_OPTS -U --batch-mode --no-transfer-progress clean package dependency:copy-dependencies -DskipTests"
 if [ "$DUBBO_VERSION" != "" ]; then
   BUILD_OPTS="$BUILD_OPTS -Ddubbo.version=$DUBBO_VERSION"
 fi
@@ -206,7 +213,8 @@ function process_case() {
 SCENARIO_BUILDER_DIR=$DIR/dubbo-scenario-builder
 echo "Building scenario builder .."
 cd $SCENARIO_BUILDER_DIR
-mvn clean package -DskipTests &> $SCENARIO_BUILDER_DIR/mvn.log
+scenario_mvn_opts="$MVN_OPTS clean package -DskipTests"
+mvn $BUILD_OPTS &> $SCENARIO_BUILDER_DIR/mvn.log
 result=$?
 if [ $result -ne 0 ]; then
   echo "Build dubbo-scenario-builder failure, please check logs: $SCENARIO_BUILDER_DIR/mvn.log"


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org