You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2021/01/09 06:31:48 UTC

[shardingsphere] branch master updated: Remove it.native mode to simplify IT (#8959)

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

menghaoran 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 4562013  Remove it.native mode to simplify IT (#8959)
4562013 is described below

commit 4562013e8b7e0e45712dcc7ed353a81a99c5fda5
Author: Liang Zhang <te...@163.com>
AuthorDate: Sat Jan 9 14:31:19 2021 +0800

    Remove it.native mode to simplify IT (#8959)
    
    * Update it.yml
    
    * Update it.yml
    
    * Remove it.native mode
    
    * Remove profile.properties
    
    * Move dockerfile to correct folder
---
 .github/workflows/it.yml                           | 10 +--
 .../{src => }/Dockerfile                           |  0
 .../shardingsphere-integration-test-suite/pom.xml  | 12 ----
 .../integration/env/IntegrateTestEnvironment.java  | 13 ++--
 .../env/IntegrateTestEnvironmentType.java          | 72 ----------------------
 .../test/resources/integrate/env-docker.properties | 56 -----------------
 .../{env-native.properties => env.properties}      |  0
 .../test/resources/integrate/profile.properties    | 18 ------
 8 files changed, 12 insertions(+), 169 deletions(-)

diff --git a/.github/workflows/it.yml b/.github/workflows/it.yml
index 78959ec..a4f8e43 100644
--- a/.github/workflows/it.yml
+++ b/.github/workflows/it.yml
@@ -43,7 +43,7 @@ jobs:
       - name: Build Project
         run: ./mvnw -B clean install -Dmaven.javadoc.skip=true -Drat.skip=true -Djacoco.skip=true -DskipITs
       - name: Run Integration Test
-        run: ./mvnw -B clean install -f shardingsphere-test/shardingsphere-integration-test/pom.xml -Pit.docker -Dit.scenarios=db
+        run: ./mvnw -B clean install -f shardingsphere-test/shardingsphere-integration-test/pom.xml -Pit.docker -Dit.scenarios=proxy -Dit.scenarios=db -Dit.mysql.host=127.0.0.1 -Dit.mysql.port=33060
   
   mysql-proxy-tbl:
     name: MySQL-Proxy with TBL scenario
@@ -64,7 +64,7 @@ jobs:
       - name: Build Project
         run: ./mvnw -B clean install -Dmaven.javadoc.skip=true -Drat.skip=true -Djacoco.skip=true -DskipITs
       - name: Run Integration Test
-        run: ./mvnw -B clean install -f shardingsphere-test/shardingsphere-integration-test/pom.xml -Pit.docker -Dit.scenarios=tbl
+        run: ./mvnw -B clean install -f shardingsphere-test/shardingsphere-integration-test/pom.xml -Pit.docker -Dit.scenarios=proxy -Dit.scenarios=tbl -Dit.mysql.host=127.0.0.1 -Dit.mysql.port=33060
   
   mysql-proxy-repilca-query:
     name: MySQL-Proxy with REPLICA-QUERY scenario
@@ -85,7 +85,7 @@ jobs:
       - name: Build Project
         run: ./mvnw -B clean install -Dmaven.javadoc.skip=true -Drat.skip=true -Djacoco.skip=true -DskipITs
       - name: Run Integration Test
-        run: ./mvnw -B clean install -f shardingsphere-test/shardingsphere-integration-test/pom.xml -Pit.docker -Dit.scenarios=repilca_query
+        run: ./mvnw -B clean install -f shardingsphere-test/shardingsphere-integration-test/pom.xml -Pit.docker -Dit.scenarios=proxy -Dit.scenarios=repilca_query -Dit.mysql.host=127.0.0.1 -Dit.mysql.port=33060
   
   mysql-proxy-dbtbl-with-proxy-repilca-query:
     name: MySQL-Proxy with DBTBL-WITH-REPLICA-QUERY scenario
@@ -104,6 +104,6 @@ jobs:
         with:
           java-version: 8
       - name: Build Project
-        run: ./mvnw -B clean install -Dmaven.javadoc.skip=true -Drat.skip=true -Djacoco.skip=true -DskipITs        
+        run: ./mvnw -B clean install -Dmaven.javadoc.skip=true -Drat.skip=true -Djacoco.skip=true -DskipITs
       - name: Run Integration Test
-        run: ./mvnw -B clean install -f shardingsphere-test/shardingsphere-integration-test/pom.xml -Pit.docker -Dit.scenarios=dbtbl_with_repilca_query
+        run: ./mvnw -B clean install -f shardingsphere-test/shardingsphere-integration-test/pom.xml -Pit.docker -Dit.scenarios=proxy -Dit.scenarios=dbtbl_with_repilca_query -Dit.mysql.host=127.0.0.1 -Dit.mysql.port=33060
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/Dockerfile b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/Dockerfile
similarity index 100%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/Dockerfile
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/Dockerfile
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml
index 53746fe..aed9ec7 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml
@@ -79,19 +79,7 @@
     
     <profiles>
         <profile>
-            <id>it.native</id>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
-            <properties>
-                <it.mode>native</it.mode>
-            </properties>
-        </profile>
-        <profile>
             <id>it.docker</id>
-            <properties>
-                <it.mode>docker</it.mode>
-            </properties>
             <build>
                 <plugins>
                     <plugin>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironment.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironment.java
index 93b523e..9b78fcb 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironment.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironment.java
@@ -45,8 +45,6 @@ public final class IntegrateTestEnvironment {
     
     private static final IntegrateTestEnvironment INSTANCE = new IntegrateTestEnvironment();
     
-    private final String activeProfile;
-
     private final Collection<String> adapters;
     
     private final boolean runAdditionalTestCases;
@@ -58,8 +56,7 @@ public final class IntegrateTestEnvironment {
     private final Map<String, DatabaseEnvironment> proxyEnvironments;
     
     private IntegrateTestEnvironment() {
-        activeProfile = loadProperties("integrate/profile.properties").getProperty("mode");
-        Properties envProps = IntegrateTestEnvironmentType.valueFromProfileName(activeProfile).loadProperties();
+        Properties envProps = loadProperties();
         adapters = Splitter.on(",").trimResults().splitToList(envProps.getProperty("it.adapters"));
         runAdditionalTestCases = Boolean.parseBoolean(envProps.getProperty("it.run.additional.cases"));
         scenarios = Splitter.on(",").trimResults().splitToList(envProps.getProperty("it.scenarios"));
@@ -67,13 +64,17 @@ public final class IntegrateTestEnvironment {
         proxyEnvironments = createProxyEnvironments(envProps);
     }
     
-    private Properties loadProperties(final String fileName) {
+    @SuppressWarnings("AccessOfSystemProperties")
+    private Properties loadProperties() {
         Properties result = new Properties();
         try {
-            result.load(IntegrateTestEnvironment.class.getClassLoader().getResourceAsStream(fileName));
+            result.load(IntegrateTestEnvironment.class.getClassLoader().getResourceAsStream("integrate/env.properties"));
         } catch (final IOException ex) {
             throw new RuntimeException(ex);
         }
+        for (String each : System.getProperties().stringPropertyNames()) {
+            result.setProperty(each, System.getProperty(each));
+        }
         return result;
     }
     
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironmentType.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironmentType.java
deleted file mode 100644
index a3e2c8d..0000000
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironmentType.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.test.integration.env;
-
-import lombok.RequiredArgsConstructor;
-
-import java.io.IOException;
-import java.util.Properties;
-
-/**
- * Integrate test environment type.
- */
-@RequiredArgsConstructor
-public enum IntegrateTestEnvironmentType {
-    
-    NATIVE("native", "integrate/env-native.properties"),
-    
-    DOCKER("docker", "integrate/env-docker.properties");
-    
-    private final String profileName;
-    
-    private final String envFileName;
-    
-    /**
-     * Get enum value from profile name.
-     * 
-     * @param profileName profile name
-     * @return enum value
-     */
-    public static IntegrateTestEnvironmentType valueFromProfileName(final String profileName) {
-        for (IntegrateTestEnvironmentType each : values()) {
-            if (each.profileName.equalsIgnoreCase(profileName)) {
-                return each;
-            }
-        }
-        return NATIVE;
-    }
-    
-    /**
-     * Load integrate test environment properties.
-     * 
-     * @return integrate test environment properties
-     */
-    @SuppressWarnings("AccessOfSystemProperties")
-    public Properties loadProperties() {
-        Properties result = new Properties();
-        try {
-            result.load(IntegrateTestEnvironment.class.getClassLoader().getResourceAsStream(envFileName));
-        } catch (final IOException ex) {
-            throw new RuntimeException(ex);
-        }
-        for (String each : System.getProperties().stringPropertyNames()) {
-            result.setProperty(each, System.getProperty(each));
-        }
-        return result;
-    }
-}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/integrate/env-docker.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/integrate/env-docker.properties
deleted file mode 100644
index 7f685b7..0000000
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/integrate/env-docker.properties
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# 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.
-#
-
-it.adapters=proxy
-#it.adapters=jdbc,proxy
-
-it.run.additional.cases=false
-#it.scenarios=db,tbl,dbtbl_with_replica_query,replica_query,shadow
-it.scenarios=db,tbl,dbtbl_with_replica_query,replica_query
-
-#it.databases=H2,MySQL,Oracle,SQLServer,PostgreSQL
-it.databases=MySQL
-
-it.mysql.host=127.0.0.1
-it.mysql.port=33060
-it.mysql.username=root
-it.mysql.password=
-
-it.postgresql.host=127.0.0.1
-it.postgresql.port=57320
-it.postgresql.username=postgres
-it.postgresql.password=postgres
-
-it.proxy.db.host=127.0.0.1
-it.proxy.db.port=33070
-it.proxy.db.username=root
-it.proxy.db.password=root
-
-it.proxy.tbl.host=127.0.0.1
-it.proxy.tbl.port=33080
-it.proxy.tbl.username=root
-it.proxy.tbl.password=root
-
-it.proxy.replica_query.host=127.0.0.1
-it.proxy.replica_query.port=33090
-it.proxy.replica_query.username=root
-it.proxy.replica_query.password=root
-
-it.proxy.dbtbl_with_replica_query.host=127.0.0.1
-it.proxy.dbtbl_with_replica_query.port=33110
-it.proxy.dbtbl_with_replica_query.username=root
-it.proxy.dbtbl_with_replica_query.password=root
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/integrate/env-native.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/integrate/env.properties
similarity index 100%
rename from shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/integrate/env-native.properties
rename to shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/integrate/env.properties
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/integrate/profile.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/integrate/profile.properties
deleted file mode 100644
index 245e1cb..0000000
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/integrate/profile.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# 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.
-#
-
-mode=${it.mode}