You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/01/21 13:47:21 UTC
[dubbo] branch master updated: [Unit Test] Use matrix build
workflow & Add Integration Test (#7078)
This is an automated email from the ASF dual-hosted git repository.
albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 27571a0 [Unit Test] Use matrix build workflow & Add Integration Test (#7078)
27571a0 is described below
commit 27571a094e668aa87797d11283ab9f0ba383b3c3
Author: Albumen Kevin <jh...@gmail.com>
AuthorDate: Thu Jan 21 21:46:33 2021 +0800
[Unit Test] Use matrix build workflow & Add Integration Test (#7078)
---
.github/workflows/build-and-test.yml | 179 +++++++++++++++++++++
.github/workflows/unit-test.yml | 67 --------
.../file/FileSystemDynamicConfigurationTest.java | 3 +
.../MultipleServicesWithMethodConfigsTest.java | 8 +
4 files changed, 190 insertions(+), 67 deletions(-)
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
new file mode 100644
index 0000000..508c5df
--- /dev/null
+++ b/.github/workflows/build-and-test.yml
@@ -0,0 +1,179 @@
+name: Build and Test
+
+on: [push, pull_request]
+
+env:
+ FORK_COUNT: 2
+ FAIL_FAST: 0
+ SHOW_ERROR_DETAIL: 1
+ #multi-version size limit
+ VERSIONS_LIMIT: 4
+ CANDIDATE_VERSIONS: '
+ spring.version:4.3.30.RELEASE;
+ spring-boot.version:1.5.22.RELEASE;
+ spring-boot.version:2.4.1;
+ '
+jobs:
+ build-source:
+ runs-on: ubuntu-18.04
+ steps:
+ - uses: actions/checkout@v2
+ - uses: actions/setup-java@v1
+ with:
+ java-version: 8
+ - uses: actions/cache@v2
+ name: "Cache local Maven repository"
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ - name: "Dubbo cache"
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2/repository/org/apache/dubbo
+ key: ${{ runner.os }}-dubbo-snapshot-${{ github.sha }}
+ - name: "Build with Maven"
+ run: ./mvnw --batch-mode -U -e --no-transfer-progress clean install -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -Dmaven.test.skip=true -Dmaven.test.skip.exec=true
+ - name: "Calculate Dubbo Version"
+ run: |
+ REVISION=`awk '/<revision>[^<]+<\/revision>/{gsub(/<revision>|<\/revision>/,"",$1);print $1;exit;}' pom.xml`
+ mkdir dubbo-version
+ echo $REVISION > dubbo-version/dubbo-version
+ - name: "Upload Dubbo version"
+ uses: actions/upload-artifact@v2
+ with:
+ name: dubbo-version
+ path: dubbo-version
+
+ unit-test:
+ needs: [build-source]
+ name: "Unit Test On ${{ matrix.os }} (JDK: ${{ matrix.jdk }})"
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ ubuntu-18.04, windows-2019 ]
+ jdk: [ 8, 11 ]
+ steps:
+ - uses: actions/checkout@v2
+ - name: "Set up JDK ${{ matrix.jdk }}"
+ uses: actions/setup-java@v1
+ with:
+ java-version: ${{ matrix.jdk }}
+ - uses: actions/cache@v2
+ name: "Cache local Maven repository"
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+ - name: "Test with Maven with Integration Tests"
+ timeout-minutes: 30
+ if: ${{ startsWith( matrix.os, 'ubuntu') }}
+ run: ./mvnw --batch-mode -U -e --no-transfer-progress clean test -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 -Dmaven.wagon.http.retryHandler.count=5 -DskipTests=false -DskipIntegrationTests=false -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
+ - name: "Test with Maven without Integration Tests"
+ env:
+ DISABLE_FILE_SYSTEM_TEST: true
+ timeout-minutes: 30
+ if: ${{ startsWith( matrix.os, 'windows') }}
+ run: ./mvnw --batch-mode -U -e --no-transfer-progress clean install -D"http.keepAlive=false" -D"maven.wagon.http.pool=false" -D"maven.wagon.httpconnectionManager.ttlSeconds=120" -D"maven.wagon.http.retryHandler.count=5" -DskipTests=false -DskipIntegrationTests=true -D"checkstyle.skip=false" -D"rat.skip=false" -D"maven.javadoc.skip=true"
+ - name: "Upload coverage to Codecov"
+ uses: codecov/codecov-action@v1
+
+ integration-test-prepare:
+ runs-on: ubuntu-18.04
+ env:
+ JOB_COUNT: 3
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ repository: 'apache/dubbo-samples'
+ ref: master
+ - name: "Prepare test list"
+ run: |
+ bash ./test/scripts/prepare-test.sh
+ - name: "Upload test list"
+ uses: actions/upload-artifact@v2
+ with:
+ name: test-list
+ path: test/jobs
+
+ integration-test-job:
+ needs: [build-source, integration-test-prepare]
+ name: "Integration Test on ubuntu-18.04 (JobId: ${{matrix.job_id}})"
+ runs-on: ubuntu-18.04
+ timeout-minutes: 30
+ env:
+ JAVA_VER: 8
+ TEST_CASE_FILE: jobs/testjob_${{matrix.job_id}}.txt
+ strategy:
+ fail-fast: false
+ matrix:
+ job_id: [1, 2, 3]
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ repository: 'apache/dubbo-samples'
+ ref: master
+ - name: "Cache local Maven repository"
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2/repository
+ key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
+ restore-keys: |
+ ${{ runner.os }}-maven-
+ - name: "Restore Dubbo cache"
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2/repository/org/apache/dubbo
+ key: ${{ runner.os }}-dubbo-snapshot-${{ github.sha }}
+ restore-keys: |
+ ${{ runner.os }}-dubbo-
+ - name: "Download test list"
+ uses: actions/download-artifact@v2
+ with:
+ name: test-list
+ path: test/jobs/
+ - name: "Download Dubbo version"
+ uses: actions/download-artifact@v2
+ with:
+ name: dubbo-version
+ path: dubbo-version
+ - name: "Set up JDK 8"
+ uses: actions/setup-java@v1
+ with:
+ java-version: 8
+ - name: "Init Candidate Versions"
+ run: |
+ DUBBO_VERSION=`cat dubbo-version/dubbo-version`
+ CANDIDATE_VERSIONS="dubbo.version:$DUBBO_VERSION;$CANDIDATE_VERSIONS"
+ echo "CANDIDATE_VERSIONS=$CANDIDATE_VERSIONS" >> $GITHUB_ENV
+ - name: "Build test image"
+ run: |
+ cd test && bash ./build-test-image.sh
+ - name: "Run tests"
+ run: cd test && bash ./run-tests.sh
+ - name: "Upload test result"
+ if: always()
+ uses: actions/upload-artifact@v2
+ with:
+ name: test-result
+ path: test/jobs/*-result*
+
+ integration-test-result:
+ needs: [integration-test-job]
+ if: always()
+ runs-on: ubuntu-18.04
+ env:
+ JAVA_VER: 8
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ repository: 'apache/dubbo-samples'
+ ref: master
+ - name: "Download test result"
+ uses: actions/download-artifact@v2
+ with:
+ name: test-result
+ path: test/jobs/
+ - name: "Merge test result"
+ run: ./test/scripts/merge-test-results.sh
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml
deleted file mode 100644
index 3d97426..0000000
--- a/.github/workflows/unit-test.yml
+++ /dev/null
@@ -1,67 +0,0 @@
-name: Unit Test
-
-on: [push, pull_request]
-
-jobs:
- ubuntu-jdk8:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - name: Set up JDK 8
- uses: actions/setup-java@v1
- with:
- java-version: 8
- - uses: actions/cache@v2
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- - name: Test with Maven
- uses: nick-invision/retry@v1
- with:
- timeout_minutes: 40
- max_attempts: 3
- command: ./mvnw --batch-mode --no-transfer-progress clean install -DskipTests=false -DskipIntegrationTests=false -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v1
-
- ubuntu-jdk11:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- - name: Set up JDK 11
- uses: actions/setup-java@v1
- with:
- java-version: 11
- - uses: actions/cache@v2
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- - name: Test with Maven
- uses: nick-invision/retry@v1
- with:
- timeout_minutes: 40
- max_attempts: 3
- command: ./mvnw --batch-mode --no-transfer-progress clean install -DskipTests=false -DskipIntegrationTests=false -Dcheckstyle.skip=false -Drat.skip=false -Dmaven.javadoc.skip=true
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v1
-
- windows-jdk11:
- runs-on: windows-latest
- steps:
- - uses: actions/checkout@v2
- - name: Set up JDK 11
- uses: actions/setup-java@v1
- with:
- java-version: 11
- - uses: actions/cache@v2
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- - name: Test with Maven
- uses: nick-invision/retry@v1
- with:
- timeout_minutes: 40
- max_attempts: 3
- command: mvn --batch-mode --no-transfer-progress clean install
- - name: Upload coverage to Codecov
- uses: codecov/codecov-action@v1
\ No newline at end of file
diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationTest.java
index 80282c1..20e127a 100644
--- a/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationTest.java
+++ b/dubbo-common/src/test/java/org/apache/dubbo/common/config/configcenter/file/FileSystemDynamicConfigurationTest.java
@@ -24,6 +24,7 @@ import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.condition.DisabledIfEnvironmentVariable;
import java.io.File;
import java.util.TreeSet;
@@ -43,6 +44,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* {@link FileSystemDynamicConfiguration} Test
*/
+// Test often failed on Github Actions Platform because of file system on Azure
+@DisabledIfEnvironmentVariable(named = "DISABLE_FILE_SYSTEM_TEST", matches = "true")
public class FileSystemDynamicConfigurationTest {
private final Logger logger = LoggerFactory.getLogger(getClass());
diff --git a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/MultipleServicesWithMethodConfigsTest.java b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/MultipleServicesWithMethodConfigsTest.java
index 00e2486..d256a46 100644
--- a/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/MultipleServicesWithMethodConfigsTest.java
+++ b/dubbo-config/dubbo-config-spring/src/test/java/org/apache/dubbo/config/spring/beans/factory/config/MultipleServicesWithMethodConfigsTest.java
@@ -16,6 +16,9 @@
*/
package org.apache.dubbo.config.spring.beans.factory.config;
+import org.apache.dubbo.rpc.model.ApplicationModel;
+
+import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -31,6 +34,11 @@ import org.springframework.test.context.junit.jupiter.SpringExtension;
@DirtiesContext(classMode = DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD)
public class MultipleServicesWithMethodConfigsTest {
+ @BeforeAll
+ public static void setUp() {
+ ApplicationModel.reset();
+ }
+
@Autowired
private ApplicationContext applicationContext;