You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by wu...@apache.org on 2021/01/02 13:43:23 UTC
[shardingsphere] branch master updated: Refactor docker-compose
file for IT (#8860)
This is an automated email from the ASF dual-hosted git repository.
wuweijie 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 7e40667 Refactor docker-compose file for IT (#8860)
7e40667 is described below
commit 7e40667d3310cfb44465a6a0faa176df89ac1abd
Author: Liang Zhang <te...@163.com>
AuthorDate: Sat Jan 2 21:42:50 2021 +0800
Refactor docker-compose file for IT (#8860)
* For code style
* Adjust docker-compose.yml
* Correct env file
* Upgrade docker-swarm mvn plugin version
* Refactor IntegrateTestEnvironmentType
* Remove temp images
* For code format
---
pom.xml | 2 +-
.../shardingsphere-proxy-docker-build/pom.xml | 2 +-
.../shardingsphere-test-suite/pom.xml | 3 +-
.../test/integration/engine/it/dcl/BaseDCLIT.java | 1 -
.../env/IntegrateTestEnvironmentType.java | 2 +-
.../src/test/resources/docker/docker-compose.yml | 32 ++++-----
.../src/test/resources/docker/mysql/init.sql | 2 +
.../resources/docker/proxy/conf/config-db.yaml | 77 ----------------------
.../test/resources/docker/proxy/conf/server.yaml | 21 ------
9 files changed, 23 insertions(+), 119 deletions(-)
diff --git a/pom.xml b/pom.xml
index 19acb34..fc622bb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -136,7 +136,7 @@
<taglist-maven-plugin.version>2.4</taglist-maven-plugin.version>
<os-maven-plugin.version>1.5.0.Final</os-maven-plugin.version>
<dockerfile-maven.version>1.4.6</dockerfile-maven.version>
- <docker-compose-maven-plugin.version>2.3.0</docker-compose-maven-plugin.version>
+ <docker-compose-maven-plugin.version>4.0.0</docker-compose-maven-plugin.version>
<javadocExecutable>${java.home}/../bin/javadoc</javadocExecutable>
<maven.deploy.skip>false</maven.deploy.skip>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-proxy-docker-build/pom.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-proxy-docker-build/pom.xml
index c8b2cc7..f650561 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-proxy-docker-build/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-proxy-docker-build/pom.xml
@@ -52,7 +52,7 @@
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
-
+
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/pom.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/pom.xml
index 63c8774..36f250f 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/pom.xml
@@ -39,7 +39,7 @@
<version>${project.version}</version>
<type>test-jar</type>
</dependency>
-
+
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
@@ -117,6 +117,7 @@
<configuration>
<composeFile>${project.basedir}/src/test/resources/docker/docker-compose.yml</composeFile>
<removeVolumes>true</removeVolumes>
+ <removeImages>true</removeImages>
</configuration>
</execution>
</executions>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/BaseDCLIT.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/BaseDCLIT.java
index c061985..2acf5f0 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/BaseDCLIT.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/engine/it/dcl/BaseDCLIT.java
@@ -99,7 +99,6 @@ public abstract class BaseDCLIT extends SingleIT {
@BeforeClass
public static void initDatabasesAndTables() throws JAXBException, IOException {
SchemaEnvironmentManager.createDatabases();
- SchemaEnvironmentManager.dropTables();
SchemaEnvironmentManager.createTables();
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironmentType.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironmentType.java
index 76b473e..96b3b16 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironmentType.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/java/org/apache/shardingsphere/test/integration/env/IntegrateTestEnvironmentType.java
@@ -45,7 +45,7 @@ public enum IntegrateTestEnvironmentType {
*/
public static IntegrateTestEnvironmentType valueFromProfileName(final String profileName) {
for (IntegrateTestEnvironmentType each : values()) {
- if (each.profileName.equals(profileName)) {
+ if (each.profileName.equalsIgnoreCase(profileName)) {
return each;
}
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/docker-compose.yml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/docker-compose.yml
index 81bf004..aac373b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/docker-compose.yml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/docker-compose.yml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-version: '3.7'
+version: "2.1"
services:
mysql:
image: "mysql/mysql-server:5.7"
@@ -26,18 +26,18 @@ services:
ports:
- "33060:3306"
shardingsphere-proxy:
- image: apache/shardingsphere-proxy-test
- container_name: shardingsphere-proxy
- ports:
- - "33070:3307"
- links:
- - "mysql:db.mysql"
- volumes:
- - ./proxy/conf:/opt/shardingsphere-proxy/conf
- depends_on:
- - mysql
- environment:
- - WAIT_HOSTS=mysql:3306
- - WAIT_HOSTS_TIMEOUT=300
- - WAIT_SLEEP_INTERVAL=5
- - WAIT_HOST_CONNECT_TIMEOUT=30
+ image: apache/shardingsphere-proxy-test
+ container_name: shardingsphere-proxy
+ ports:
+ - "33070:3307"
+ links:
+ - "mysql:db.mysql"
+ volumes:
+ - ./proxy/conf:/opt/shardingsphere-proxy/conf
+ depends_on:
+ - mysql
+ environment:
+ - WAIT_HOSTS=mysql:3306
+ - WAIT_HOSTS_TIMEOUT=300
+ - WAIT_SLEEP_INTERVAL=5
+ - WAIT_HOST_CONNECT_TIMEOUT=30
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/mysql/init.sql b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/mysql/init.sql
index 6caf82e..7a99a38 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/mysql/init.sql
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/mysql/init.sql
@@ -17,6 +17,7 @@
CREATE USER 'root'@'%' IDENTIFIED BY '';
GRANT All privileges ON *.* TO 'root'@'%';
+
CREATE DATABASE db_0;
CREATE DATABASE db_1;
CREATE DATABASE db_2;
@@ -53,6 +54,7 @@ CREATE DATABASE replica_1;
CREATE DATABASE tbl;
CREATE DATABASE db;
CREATE DATABASE shadow_db;
+
CREATE TABLE db_0.t_order (order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (order_id));
CREATE TABLE db_0.t_order_item (item_id INT NOT NULL, order_id INT NOT NULL, user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
CREATE TABLE db_0.t_broadcast_table (id INT NOT NULL, status VARCHAR(45) NULL, PRIMARY KEY (id));
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/config-db.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/config-db.yaml
index 3e983f1..94960f2 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/config-db.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/config-db.yaml
@@ -15,82 +15,6 @@
# limitations under the License.
#
-#schemaName: sharding_db
-#
-#dataSources:
-# ds_0:
-# url: jdbc:postgresql://127.0.0.1:5432/demo_ds_0?serverTimezone=UTC&useSSL=false
-# username: postgres
-# password: postgres
-# connectionTimeoutMilliseconds: 30000
-# idleTimeoutMilliseconds: 60000
-# maxLifetimeMilliseconds: 1800000
-# maxPoolSize: 50
-# ds_1:
-# url: jdbc:postgresql://127.0.0.1:5432/demo_ds_1?serverTimezone=UTC&useSSL=false
-# username: postgres
-# password: postgres
-# connectionTimeoutMilliseconds: 30000
-# idleTimeoutMilliseconds: 60000
-# maxLifetimeMilliseconds: 1800000
-# maxPoolSize: 50
-#
-#rules:
-#- !SHARDING
-# tables:
-# t_order:
-# actualDataNodes: ds_${0..1}.t_order_${0..1}
-# tableStrategy:
-# standard:
-# shardingColumn: order_id
-# shardingAlgorithmName: t_order_inline
-# keyGenerateStrategy:
-# column: order_id
-# keyGeneratorName: snowflake
-# t_order_item:
-# actualDataNodes: ds_${0..1}.t_order_item_${0..1}
-# tableStrategy:
-# standard:
-# shardingColumn: order_id
-# shardingAlgorithmName: t_order_item_inline
-# keyGenerateStrategy:
-# column: order_item_id
-# keyGeneratorName: snowflake
-# bindingTables:
-# - t_order,t_order_item
-# defaultDatabaseStrategy:
-# standard:
-# shardingColumn: user_id
-# shardingAlgorithmName: database_inline
-# defaultTableStrategy:
-# none:
-#
-# shardingAlgorithms:
-# database_inline:
-# type: INLINE
-# props:
-# algorithm-expression: ds_${user_id % 2}
-# t_order_inline:
-# type: INLINE
-# props:
-# algorithm-expression: t_order_${order_id % 2}
-# t_order_item_inline:
-# type: INLINE
-# props:
-# algorithm-expression: t_order_item_${order_id % 2}
-#
-# keyGenerators:
-# snowflake:
-# type: SNOWFLAKE
-# props:
-# worder.id: 123
-
-######################################################################################################
-#
-# If you want to connect to MySQL, you should manually copy MySQL driver to lib directory.
-#
-######################################################################################################
-
schemaName: proxy_db
dataSources:
@@ -223,4 +147,3 @@ rules:
keyGenerators:
constant:
type: CONSTANT
-
\ No newline at end of file
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/server.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/server.yaml
index d06ca16..b9571fe 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/server.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-test-suite/src/test/resources/docker/proxy/conf/server.yaml
@@ -15,24 +15,6 @@
# limitations under the License.
#
-######################################################################################################
-#
-# If you want to configure governance, authorization and proxy properties, please refer to this file.
-#
-######################################################################################################
-#
-#governance:
-# name: governance_ds
-# registryCenter:
-# type: ZooKeeper
-# serverLists: localhost:2181
-# props:
-# retryIntervalMilliseconds: 500
-# timeToLiveSeconds: 60
-# maxRetries: 3
-# operationTimeoutMilliseconds: 500
-# overwrite: false
-
authentication:
users:
root:
@@ -46,9 +28,6 @@ props:
acceptor-size: 16 # The default value is available processors count * 2.
executor-size: 16 # Infinite by default.
proxy-frontend-flush-threshold: 128 # The default value is 128.
- # LOCAL: Proxy will run with LOCAL transaction.
- # XA: Proxy will run with XA transaction.
- # BASE: Proxy will run with B.A.S.E transaction.
proxy-transaction-type: LOCAL
proxy-opentracing-enabled: false
proxy-hint-enabled: false