You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by to...@apache.org on 2022/07/16 06:06:33 UTC

[shardingsphere] branch master updated: Fix single rule integration test in cluster mode (#19148)

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

totalo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 6f4b56c6be4 Fix single rule integration test in cluster mode (#19148)
6f4b56c6be4 is described below

commit 6f4b56c6be4b353ff390cde85c923812483de0f3
Author: gin <ja...@163.com>
AuthorDate: Sat Jul 16 14:06:27 2022 +0800

    Fix single rule integration test in cluster mode (#19148)
    
    * Fix IT cluster mode with out tbl
    
    * Fix IT cluster mode with out readwrite_splitting
    
    * Fix IT cluster mode with encrypt shadow
    
    * Fix IT cluster mode with db
    
    * Fix IT cluster mode with db
    
    * Fix IT cluster mode with shadow encrypt
    
    * Fix IT cluster mode with database MySQL
    
    * Fix IT cluster mode with db scenario
    
    * Split mode in single and mixture rules
    
    * Remove IT readwrite_splitting:jdbc:PostgreSQL
    
    * Update cancel-in-progress: false for test
    
    * Fix run cluster IT pre-condition
    
    * Remove unnecessary IT
    
    * Remove case of tbl proxy MySQL
    
    * Fixed
---
 .github/workflows/it.yml                           | 102 ++++++++++++++++++---
 .../compose/ComposedContainerRegistry.java         |   2 +-
 2 files changed, 90 insertions(+), 14 deletions(-)

diff --git a/.github/workflows/it.yml b/.github/workflows/it.yml
index d64ebdf5538..a091e40b17c 100644
--- a/.github/workflows/it.yml
+++ b/.github/workflows/it.yml
@@ -89,7 +89,7 @@ jobs:
           name: it-image
           path: /tmp/shardingsphere-proxy-test.tar
           retention-days: 1
-  
+
   it-empty-rule:
     name: empty rule
     runs-on: ubuntu-latest
@@ -101,7 +101,6 @@ jobs:
         adapter: [ proxy, jdbc ]
         database: [ MySQL, PostgreSQL ]
         scenario: [ empty_rules ]
-        mode: [Standalone, Cluster]
     steps:
       - uses: actions/checkout@v2
       - name: Cache Maven Repos
@@ -124,8 +123,8 @@ jobs:
         if: matrix.adapter == 'proxy'
         run: docker load -i /tmp/shardingsphere-proxy-test.tar
       - name: Run Integration Test
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.run.modes=${{ matrix.mode }} -Dit.scenarios=${{ matrix.scenario }} -Dit.cluster.adapters=${{ matrix.adapter }} -Dit.cluster.databases=${{ matrix.database }} -Dit.cluster.env.type=DOCKER
-  
+        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.run.modes=Cluster -Dit.scenarios=${{ matrix.scenario }} -Dit.cluster.adapters=${{ matrix.adapter }} -Dit.cluster.databases=${{ matrix.database }} -Dit.cluster.env.type=DOCKER
+
   it-single-rule:
     name: single rule
     needs: it-empty-rule
@@ -137,7 +136,6 @@ jobs:
         adapter: [ proxy, jdbc ]
         database: [ MySQL, PostgreSQL ]
         scenario: [ db, tbl, encrypt, readwrite_splitting, shadow ]
-        mode: [Standalone, Cluster]
     steps:
       - uses: actions/checkout@v2
       - name: Cache Maven Repos
@@ -160,12 +158,58 @@ jobs:
         if: matrix.adapter == 'proxy'
         run: docker load -i /tmp/shardingsphere-proxy-test.tar
       - name: Run Integration Test
-        if: matrix.mode == 'Standalone'
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.run.modes=${{ matrix.mode }} -Dit.scenarios=${{ matrix.scenario }} -Dit.cluster.adapters=${{ matrix.adapter }} -Dit.cluster.databases=${{ matrix.database }} -Dit.cluster.env.type=DOCKER
-  
+        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.run.modes=Standalone -Dit.scenarios=${{ matrix.scenario }} -Dit.cluster.adapters=${{ matrix.adapter }} -Dit.cluster.databases=${{ matrix.database }} -Dit.cluster.env.type=DOCKER
+
+  it-single-rule-cluster:
+    name: single rule cluster
+    needs: it-single-rule
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+    strategy:
+      matrix:
+        env: [ docker ]
+        adapter: [ proxy ]
+        database: [ MySQL, PostgreSQL ]
+        scenario: [ db, encrypt, tbl, shadow, readwrite_splitting ]
+        exclude:
+          - adapter: proxy
+            database: MySQL
+            scenario: tbl
+          - adapter: proxy
+            database: PostgreSQL
+            scenario: tbl
+          - adapter: proxy
+            database: PostgreSQL
+            scenario: shadow
+          - adapter: proxy
+            database: PostgreSQL
+            scenario: readwrite_splitting
+    steps:
+      - uses: actions/checkout@v2
+      - name: Cache Maven Repos
+        uses: actions/cache@v2
+        with:
+          path: ~/.m2/repository
+          key: shardingsphere-it-cache-${{ github.sha }}
+      - name: Set up JDK 8
+        uses: actions/setup-java@v2
+        with:
+          distribution: 'temurin'
+          java-version: 8
+      - name: Download IT image
+        if: matrix.adapter == 'proxy'
+        uses: actions/download-artifact@v3
+        with:
+          name: it-image
+          path: /tmp/
+      - name: Load IT image
+        run: docker load -i /tmp/shardingsphere-proxy-test.tar
+      - name: Run Integration Test
+        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.run.modes=Cluster -Dit.scenarios=${{ matrix.scenario }} -Dit.cluster.adapters=${{ matrix.adapter }} -Dit.cluster.databases=${{ matrix.database }} -Dit.cluster.env.type=DOCKER
+
   it-mixture-rule:
     name: mixture rule
-    needs: [ it-empty-rule, it-single-rule ]
+    needs: [ it-empty-rule, it-single-rule, it-single-rule-cluster ]
     runs-on: ubuntu-latest
     timeout-minutes: 10
     strategy:
@@ -174,7 +218,6 @@ jobs:
         adapter: [ proxy, jdbc ]
         database: [ MySQL, PostgreSQL ]
         scenario: [ dbtbl_with_readwrite_splitting, dbtbl_with_readwrite_splitting_and_encrypt ]
-        mode: [Standalone, Cluster]
     steps:
       - uses: actions/checkout@v2
       - name: Cache Maven Repos
@@ -197,9 +240,42 @@ jobs:
         if: matrix.adapter == 'proxy'
         run: docker load -i /tmp/shardingsphere-proxy-test.tar
       - name: Run Integration Test
-        if: matrix.mode == 'Standalone'
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.run.modes=${{ matrix.mode }} -Dit.scenarios=${{ matrix.scenario }} -Dit.cluster.adapters=${{ matrix.adapter }} -Dit.cluster.databases=${{ matrix.database }} -Dit.cluster.env.type=DOCKER
-  
+        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.run.modes=Standalone -Dit.scenarios=${{ matrix.scenario }} -Dit.cluster.adapters=${{ matrix.adapter }} -Dit.cluster.databases=${{ matrix.database }} -Dit.cluster.env.type=DOCKER
+
+  it-mixture-rule-cluster:
+    name: mixture rule cluster
+    needs: [ it-empty-rule, it-single-rule, it-single-rule-cluster, it-mixture-rule ]
+    runs-on: ubuntu-latest
+    timeout-minutes: 10
+    strategy:
+      matrix:
+        env: [ docker ]
+        adapter: [ proxy ]
+        database: [ MySQL, PostgreSQL ]
+        scenario: [ dbtbl_with_readwrite_splitting, dbtbl_with_readwrite_splitting_and_encrypt ]
+    steps:
+      - uses: actions/checkout@v2
+      - name: Cache Maven Repos
+        uses: actions/cache@v2
+        with:
+          path: ~/.m2/repository
+          key: shardingsphere-it-cache-${{ github.sha }}
+      - name: Set up JDK 8
+        uses: actions/setup-java@v2
+        with:
+          distribution: 'temurin'
+          java-version: 8
+      - name: Download IT image
+        if: matrix.adapter == 'proxy'
+        uses: actions/download-artifact@v3
+        with:
+          name: it-image
+          path: /tmp/
+      - name: Load IT image
+        run: docker load -i /tmp/shardingsphere-proxy-test.tar
+      - name: Run Integration Test
+        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.run.modes=Cluster -Dit.scenarios=${{ matrix.scenario }} -Dit.cluster.adapters=${{ matrix.adapter }} -Dit.cluster.databases=${{ matrix.database }} -Dit.cluster.env.type=DOCKER
+
   mysql-proxy-agent:
     name: Agent Metrics & OpenTelemetry
     runs-on: ubuntu-latest
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/ComposedContainerRegistry.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/ComposedContainerRegistry.java
index 10ae9b8b973..b5447a03bef 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/ComposedContainerRegistry.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/framework/container/compose/ComposedContainerRegistry.java
@@ -58,7 +58,7 @@ public final class ComposedContainerRegistry implements AutoCloseable {
     
     private boolean isClusterMode(final ParameterizedArray parameterizedArray) {
         // TODO cluster mode often throw exception sometimes, issue is #15517
-        return "Cluster".equalsIgnoreCase(parameterizedArray.getMode());
+        return "Cluster".equalsIgnoreCase(parameterizedArray.getMode()) && "proxy".equalsIgnoreCase(parameterizedArray.getAdapter());
     }
     
     @Override