You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2021/04/01 11:54:06 UTC
[shardingsphere] branch master updated: Support governance env for
IT (#9874)
This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 8f941f3 Support governance env for IT (#9874)
8f941f3 is described below
commit 8f941f332079cde79bf19d972aefae38a918f272
Author: Daming <zt...@foxmail.com>
AuthorDate: Thu Apr 1 19:53:28 2021 +0800
Support governance env for IT (#9874)
* support governance
* fix checkstyle
* skip 'governance' test case in CI env and build
---
.github/workflows/it.yml | 2 +-
.../pom.xml | 6 ++
.../integration/junit/compose/ComposeManager.java | 7 +-
.../junit/compose/ContainerCompose.java | 81 ++++++++++++++++------
.../junit/compose/GovernanceContainerCompose.java | 75 ++++++++++++++++++++
.../junit/compose/SimpleContainerCompose.java | 45 ++++++++++++
.../junit/container/ShardingSphereContainer.java | 2 +-
.../adapter/ShardingSphereAdapterContainer.java | 1 +
.../adapter/impl/ShardingSphereJDBCContainer.java | 5 +-
.../adapter/impl/ShardingSphereProxyContainer.java | 6 +-
.../container/governance/ZookeeperContainer.java | 31 +++++++++
.../sharding_governance/mysql/show_databases.xml | 23 ++++++
.../proxy/conf/config-sharding-governance.yaml | 4 +-
.../src/test/resources/env/engine-env.properties | 2 +-
14 files changed, 260 insertions(+), 30 deletions(-)
diff --git a/.github/workflows/it.yml b/.github/workflows/it.yml
index 270ccd9..28b945a 100644
--- a/.github/workflows/it.yml
+++ b/.github/workflows/it.yml
@@ -50,7 +50,7 @@ jobs:
- name: set environment
run: export MAVEN_OPS=' -Dmaven.javadoc.skip=true -Drat.skip=true -Djacoco.skip=true'
- name: Build Project
- run: ./mvnw -B clean install -am -pl shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite -Pit.env.docker
+ run: ./mvnw -B clean install -am -pl shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite -Pit.env.docker -DskipTests
- name: Run Integration Test
run: ./mvnw -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/pom.xml -Dit.adapters=${{ matrix.adapter }} -Dit.databases=MySQL -Dit.scenarios=${{ matrix.scenario }} -Dit.env.type=DOCKER
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/pom.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/pom.xml
index 1a095dc..4fdd7af 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/pom.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/pom.xml
@@ -54,6 +54,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-jdbc-governance</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
</dependency>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ComposeManager.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ComposeManager.java
index 64a1273..0892b9c 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ComposeManager.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ComposeManager.java
@@ -45,7 +45,12 @@ public final class ComposeManager extends ExternalResource {
if (composeMap.containsKey(key)) {
return composeMap.get(key);
}
- ContainerCompose result = new ContainerCompose(suiteName, parameterizedArray);
+ ContainerCompose result;
+ if ("sharding_governance".equals(parameterizedArray.getScenario())) {
+ result = new GovernanceContainerCompose(suiteName, parameterizedArray);
+ } else {
+ result = new SimpleContainerCompose(suiteName, parameterizedArray);
+ }
composeMap.put(key, result);
return result;
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ContainerCompose.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ContainerCompose.java
index 04aaad3..fbc937a 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ContainerCompose.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/ContainerCompose.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.test.integration.junit.compose;
+import lombok.AccessLevel;
import lombok.Getter;
import org.apache.shardingsphere.test.integration.junit.container.ShardingSphereContainer;
import org.apache.shardingsphere.test.integration.junit.container.adapter.ShardingSphereAdapterContainer;
@@ -32,17 +33,20 @@ import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.lifecycle.Startable;
+import javax.sql.DataSource;
import java.io.Closeable;
-import java.util.Arrays;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
/**
* Container compose.
*/
-public final class ContainerCompose extends ExternalResource implements Closeable {
+@Getter(AccessLevel.PROTECTED)
+public abstract class ContainerCompose extends ExternalResource implements Closeable {
private final Network network = Network.newNetwork();
@@ -50,26 +54,16 @@ public final class ContainerCompose extends ExternalResource implements Closeabl
private final ParameterizedArray parameterizedArray;
- private final List<ShardingSphereContainer> containers;
-
- @Getter
- private final ShardingSphereStorageContainer storageContainer;
-
- @Getter
- private final ShardingSphereAdapterContainer adapterContainer;
+ private final List<ShardingSphereContainer> containers = new ArrayList<>();
private volatile boolean started;
public ContainerCompose(final String clusterName, final ParameterizedArray parameterizedArray) {
this.clusterName = clusterName;
this.parameterizedArray = parameterizedArray;
- this.storageContainer = createStorageContainer();
- this.adapterContainer = createAdapterContainer();
- adapterContainer.dependsOn(storageContainer);
- this.containers = Arrays.asList(storageContainer, adapterContainer);
}
- private ShardingSphereAdapterContainer createAdapterContainer() {
+ protected ShardingSphereAdapterContainer createAdapterContainer() {
Supplier<ShardingSphereAdapterContainer> supplier = () -> {
switch (parameterizedArray.getAdapter()) {
case "proxy":
@@ -81,13 +75,10 @@ public final class ContainerCompose extends ExternalResource implements Closeabl
}
};
- ShardingSphereAdapterContainer result = supplier.get();
- result.setNetwork(network);
- result.withLogConsumer(ContainerLogs.newConsumer(this.clusterName + "-adapter"));
- return result;
+ return createContainer(supplier, "adapter");
}
- private ShardingSphereStorageContainer createStorageContainer() {
+ protected ShardingSphereStorageContainer createStorageContainer() {
Supplier<ShardingSphereStorageContainer> supplier = () -> {
switch (parameterizedArray.getDatabaseType().getName()) {
case "MySQL":
@@ -98,10 +89,15 @@ public final class ContainerCompose extends ExternalResource implements Closeabl
throw new RuntimeException("Unknown storage type " + parameterizedArray.getDatabaseType());
}
};
- ShardingSphereStorageContainer result = supplier.get();
+ return createContainer(supplier, "mysql.db.host");
+ }
+
+ protected final <T extends ShardingSphereContainer> T createContainer(final Supplier<T> supplier, final String hostName) {
+ T result = supplier.get();
+ containers.add(result);
result.setNetwork(network);
- result.withLogConsumer(ContainerLogs.newConsumer(this.clusterName + "-storage"));
- result.setNetworkAliases(Collections.singletonList("mysql.db.host"));
+ result.setNetworkAliases(Collections.singletonList(hostName));
+ result.withLogConsumer(ContainerLogs.newConsumer(String.join("-", clusterName, result.getDockerName())));
return result;
}
@@ -137,6 +133,47 @@ public final class ContainerCompose extends ExternalResource implements Closeabl
started = true;
}
+ /**
+ * Get adapter container.
+ *
+ * @return ShardingSphere adapter container
+ */
+ public abstract ShardingSphereAdapterContainer getAdapterContainer();
+
+ /**
+ * Get storage container.
+ *
+ * @return ShardingSphere storage container
+ */
+ public abstract ShardingSphereStorageContainer getStorageContainer();
+
+ /**
+ * Get target datasource for writer.
+ *
+ * @return datasource
+ */
+ public DataSource getDataSourceForWriter() {
+ return getAdapterContainer().getDataSource();
+ }
+
+ /**
+ * Get target datasource for reader.
+ *
+ * @return datasource
+ */
+ public DataSource getDataSourceForReader() {
+ return getAdapterContainer().getDataSource();
+ }
+
+ /**
+ * Get all target datasources.
+ *
+ * @return datasource map
+ */
+ public Map<String, DataSource> getDataSourceMap() {
+ return Collections.singletonMap(getAdapterContainer().getDockerName(), getAdapterContainer().getDataSource());
+ }
+
@Override
protected void before() {
if (!started) {
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/GovernanceContainerCompose.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/GovernanceContainerCompose.java
new file mode 100644
index 0000000..91c1ec9
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/GovernanceContainerCompose.java
@@ -0,0 +1,75 @@
+/*
+ * 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.junit.compose;
+
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.test.integration.junit.container.adapter.ShardingSphereAdapterContainer;
+import org.apache.shardingsphere.test.integration.junit.container.adapter.impl.ShardingSphereProxyContainer;
+import org.apache.shardingsphere.test.integration.junit.container.governance.ZookeeperContainer;
+import org.apache.shardingsphere.test.integration.junit.container.storage.ShardingSphereStorageContainer;
+import org.apache.shardingsphere.test.integration.junit.param.model.ParameterizedArray;
+
+import javax.sql.DataSource;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+@Slf4j
+public final class GovernanceContainerCompose extends ContainerCompose {
+
+ @Getter
+ private final ShardingSphereStorageContainer storageContainer;
+
+ @Getter
+ private final ShardingSphereAdapterContainer adapterContainer;
+
+ private final ShardingSphereAdapterContainer adapterContainerForReader;
+
+ public GovernanceContainerCompose(final String clusterName, final ParameterizedArray parameterizedArray) {
+ super(clusterName, parameterizedArray);
+ this.storageContainer = createStorageContainer();
+ this.adapterContainer = createAdapterContainer();
+ this.storageContainer.setNetworkAliases(Collections.singletonList("mysql.sharding-governance.host"));
+ ZookeeperContainer zookeeperContainer = createZookeeperContainer();
+ if ("proxy".equals(parameterizedArray.getAdapter())) {
+ adapterContainerForReader = createContainer(() -> new ShardingSphereProxyContainer("ShardingSphere-Proxy-1", parameterizedArray), "ShardingSphere-Proxy-1");
+ adapterContainerForReader.dependsOn(storageContainer, zookeeperContainer);
+ } else {
+ adapterContainerForReader = this.adapterContainer;
+ }
+ adapterContainer.dependsOn(storageContainer, zookeeperContainer);
+ }
+
+ private ZookeeperContainer createZookeeperContainer() {
+ return createContainer(() -> new ZookeeperContainer(getParameterizedArray()), "zk");
+ }
+
+ @Override
+ public DataSource getDataSourceForReader() {
+ return adapterContainerForReader.getDataSource();
+ }
+
+ @Override
+ public Map<String, DataSource> getDataSourceMap() {
+ Map<String, DataSource> result = new HashMap<>(2);
+ result.put(adapterContainer.getDockerName(), adapterContainer.getDataSource());
+ result.put(adapterContainerForReader.getDockerName(), adapterContainerForReader.getDataSource());
+ return result;
+ }
+}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/SimpleContainerCompose.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/SimpleContainerCompose.java
new file mode 100644
index 0000000..7605e18
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/compose/SimpleContainerCompose.java
@@ -0,0 +1,45 @@
+/*
+ * 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.junit.compose;
+
+import lombok.Getter;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.test.integration.junit.container.adapter.ShardingSphereAdapterContainer;
+import org.apache.shardingsphere.test.integration.junit.container.storage.ShardingSphereStorageContainer;
+import org.apache.shardingsphere.test.integration.junit.param.model.ParameterizedArray;
+
+/**
+ * Container compose.
+ */
+@Slf4j
+public final class SimpleContainerCompose extends ContainerCompose {
+
+ @Getter
+ private final ShardingSphereStorageContainer storageContainer;
+
+ @Getter
+ private final ShardingSphereAdapterContainer adapterContainer;
+
+ public SimpleContainerCompose(final String clusterName, final ParameterizedArray parameterizedArray) {
+ super(clusterName, parameterizedArray);
+ this.storageContainer = createStorageContainer();
+ this.adapterContainer = createAdapterContainer();
+ adapterContainer.dependsOn(storageContainer);
+ }
+
+}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereContainer.java
index 8347506..59e11ea 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/ShardingSphereContainer.java
@@ -104,7 +104,7 @@ public abstract class ShardingSphereContainer extends GenericContainer<ShardingS
// CHECKSTYLE:OFF
} catch (final Exception ex) {
// CHECKSTYLE:ON
- log.warn("Failed to check container {} healthy.", c.getDockerName(), ex);
+ log.info("Failed to check container {} healthy.", c.getDockerName(), ex);
return false;
}
})
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/ShardingSphereAdapterContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/ShardingSphereAdapterContainer.java
index 02a3ab3..af53b74 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/ShardingSphereAdapterContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/ShardingSphereAdapterContainer.java
@@ -49,4 +49,5 @@ public abstract class ShardingSphereAdapterContainer extends ShardingSphereConta
* @return DataSource
*/
public abstract DataSource getDataSource();
+
}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/impl/ShardingSphereJDBCContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/impl/ShardingSphereJDBCContainer.java
index 476190c..37f13f0 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/impl/ShardingSphereJDBCContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/impl/ShardingSphereJDBCContainer.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.test.integration.junit.container.adapter.impl;
import org.apache.shardingsphere.driver.api.yaml.YamlShardingSphereDataSourceFactory;
+import org.apache.shardingsphere.driver.governance.api.yaml.YamlGovernanceShardingSphereDataSourceFactory;
import org.apache.shardingsphere.test.integration.env.EnvironmentPath;
import org.apache.shardingsphere.test.integration.junit.container.ShardingSphereContainer;
import org.apache.shardingsphere.test.integration.junit.container.adapter.ShardingSphereAdapterContainer;
@@ -51,7 +52,6 @@ public final class ShardingSphereJDBCContainer extends ShardingSphereAdapterCont
@Override
public void start() {
super.start();
- // do not start because it is a fake container.
List<Startable> startables = getDependencies().stream()
.filter(e -> e instanceof ShardingSphereStorageContainer)
.collect(Collectors.toList());
@@ -66,6 +66,9 @@ public final class ShardingSphereJDBCContainer extends ShardingSphereAdapterCont
*/
public DataSource getDataSource() {
try {
+ if ("sharding_governance".equals(getParameterizedArray().getScenario())) {
+ return YamlGovernanceShardingSphereDataSourceFactory.createDataSource(new File(EnvironmentPath.getRulesConfigurationFile(getParameterizedArray().getScenario())));
+ }
return YamlShardingSphereDataSourceFactory.createDataSource(dataSourceMap, new File(EnvironmentPath.getRulesConfigurationFile(getParameterizedArray().getScenario())));
} catch (SQLException | IOException ex) {
throw new RuntimeException(ex);
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/impl/ShardingSphereProxyContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/impl/ShardingSphereProxyContainer.java
index 156e13d..5e0363b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/impl/ShardingSphereProxyContainer.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/adapter/impl/ShardingSphereProxyContainer.java
@@ -43,7 +43,11 @@ public final class ShardingSphereProxyContainer extends ShardingSphereAdapterCon
private final AtomicReference<DataSource> dataSourceProvider = new AtomicReference<>();
public ShardingSphereProxyContainer(final ParameterizedArray parameterizedArray) {
- super("shardingsphere-proxy", "apache/shardingsphere-proxy-test", parameterizedArray);
+ this(null, parameterizedArray);
+ }
+
+ public ShardingSphereProxyContainer(final String dockerName, final ParameterizedArray parameterizedArray) {
+ super(Objects.isNull(dockerName) ? "ShardingSphere-Proxy" : dockerName, "apache/shardingsphere-proxy-test", parameterizedArray);
}
/**
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/governance/ZookeeperContainer.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/governance/ZookeeperContainer.java
new file mode 100644
index 0000000..caacd07
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-fixture/src/test/java/org/apache/shardingsphere/test/integration/junit/container/governance/ZookeeperContainer.java
@@ -0,0 +1,31 @@
+/*
+ * 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.junit.container.governance;
+
+import org.apache.shardingsphere.test.integration.junit.container.ShardingSphereContainer;
+import org.apache.shardingsphere.test.integration.junit.param.model.ParameterizedArray;
+import org.testcontainers.containers.wait.strategy.LogMessageWaitStrategy;
+
+public class ZookeeperContainer extends ShardingSphereContainer {
+
+ public ZookeeperContainer(final ParameterizedArray parameterizedArray) {
+ super("zookeeper", "zookeeper:3.6.2", false, parameterizedArray);
+ setWaitStrategy(new LogMessageWaitStrategy().withRegEx(".*PrepRequestProcessor \\(sid:[0-9]+\\) started.*"));
+ }
+
+}
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dal/dataset/sharding_governance/mysql/show_databases.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dal/dataset/sharding_governance/mysql/show_databases.xml
new file mode 100644
index 0000000..e9dc0f8
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/cases/dal/dataset/sharding_governance/mysql/show_databases.xml
@@ -0,0 +1,23 @@
+<!--
+ ~ 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.
+ -->
+
+<dataset>
+ <metadata>
+ <column name="schema_name" />
+ </metadata>
+ <row values="sharding_governance" />
+</dataset>
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/proxy/conf/config-sharding-governance.yaml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/proxy/conf/config-sharding-governance.yaml
index ed960cc..7dbb01d 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/proxy/conf/config-sharding-governance.yaml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/docker/sharding_governance/proxy/conf/config-sharding-governance.yaml
@@ -15,10 +15,10 @@
# limitations under the License.
#
-schemaName: sharding-governance
+schemaName: sharding_governance
dataSources:
- governance:
+ governance_db:
url: jdbc:mysql://mysql.sharding-governance.host:3306/governance_db?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
username: root
password:
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/engine-env.properties b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/engine-env.properties
index 5b8ea79..116a239 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/engine-env.properties
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/engine-env.properties
@@ -21,7 +21,7 @@ it.env.type=${it.env}
it.adapters=jdbc
#it.scenarios=db,tbl,dbtbl_with_read_write_splitting,read_write_splitting,encrypt,dbtbl_with_read_write_splitting_and_encrypt,sharding_governance,shadow
-it.scenarios=db,tbl,dbtbl_with_read_write_splitting,read_write_splitting,encrypt,dbtbl_with_read_write_splitting_and_encrypt,sharding_governance
+it.scenarios=db,tbl,dbtbl_with_read_write_splitting,read_write_splitting,encrypt,dbtbl_with_read_write_splitting_and_encrypt
#it.databases=H2,MySQL,Oracle,SQLServer,PostgreSQL
it.databases=H2