This is an automated email from the ASF dual-hosted git repository.
duanzhengqiang 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 c80e6788eaf Support internal proxy in e2e. (#34013)
c80e6788eaf is described below
commit c80e6788eaf786dc8308b163f37c646238063ec5
Author: Cong Hu <[email protected]>
AuthorDate: Thu Dec 12 09:42:33 2024 +0800
Support internal proxy in e2e. (#34013)
---
.../proxy/frontend/ShardingSphereProxy.java | 15 +-
.../ProxyClusterContainerConfigurationFactory.java | 2 +-
.../adapter/impl/ShardingSphereProxyContainer.java | 193 +++++++++++++++++++++
.../pipeline/cases/PipelineContainerComposer.java | 3 +-
.../data/pipeline/env/PipelineE2EEnvironment.java | 4 +
.../pipeline/env/enums/PipelineProxyTypeEnum.java | 23 +++
.../container/compose/DockerContainerComposer.java | 34 +++-
...eProxyClusterContainerConfigurationFactory.java | 4 +-
.../src/test/resources/env/it-env.properties | 1 +
9 files changed, 266 insertions(+), 13 deletions(-)
diff --git
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java
b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java
index 13605c5f013..e9dd6229652 100644
---
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java
+++
b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/ShardingSphereProxy.java
@@ -101,7 +101,15 @@ public final class ShardingSphereProxy {
});
}
- private List<ChannelFuture> startInternal(final int port, final
List<String> addresses) throws InterruptedException {
+ /**
+ * Start ShardingSphere-Proxy.
+ *
+ * @param port port
+ * @param addresses addresses
+ * @return ChannelFuture list
+ * @throws InterruptedException interrupted exception
+ */
+ public List<ChannelFuture> startInternal(final int port, final
List<String> addresses) throws InterruptedException {
ServerBootstrap bootstrap = new ServerBootstrap();
initServerBootstrap(bootstrap);
List<ChannelFuture> result = new ArrayList<>(addresses.size());
@@ -146,7 +154,10 @@ public final class ShardingSphereProxy {
.childHandler(new
ServerHandlerInitializer(FrontDatabaseProtocolTypeFactory.getDatabaseType()));
}
- private void close() {
+ /**
+ * Close ShardingSphere-Proxy.
+ */
+ public void close() {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
BackendExecutorContext.getInstance().getExecutorEngine().close();
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/config/ProxyClusterContainerConfigurationFactory.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/config/ProxyClusterContainerConfigurationFactory.java
index 368fed135b7..8555ae10c02 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/config/ProxyClusterContainerConfigurationFactory.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/config/ProxyClusterContainerConfigurationFactory.java
@@ -42,6 +42,6 @@ public final class ProxyClusterContainerConfigurationFactory {
}
private static Map<String, String> getMountedResources() {
- return Collections.singletonMap("/env/log/logback.xml",
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "logback.xml");
+ return Collections.singletonMap("env/log/logback.xml",
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "logback.xml");
}
}
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/impl/ShardingSphereProxyContainer.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/impl/ShardingSphereProxyContainer.java
new file mode 100644
index 00000000000..262a55864a1
--- /dev/null
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/atomic/adapter/impl/ShardingSphereProxyContainer.java
@@ -0,0 +1,193 @@
+/*
+ * 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.e2e.env.container.atomic.adapter.impl;
+
+import lombok.Setter;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.SystemUtils;
+import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
+import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
+import org.apache.shardingsphere.proxy.backend.config.ProxyConfigurationLoader;
+import org.apache.shardingsphere.proxy.backend.config.YamlProxyConfiguration;
+import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
+import org.apache.shardingsphere.proxy.frontend.ShardingSphereProxy;
+import org.apache.shardingsphere.proxy.frontend.ssl.ProxySSLContext;
+import org.apache.shardingsphere.proxy.initializer.BootstrapInitializer;
+import
org.apache.shardingsphere.test.e2e.env.container.atomic.EmbeddedITContainer;
+import
org.apache.shardingsphere.test.e2e.env.container.atomic.adapter.AdapterContainer;
+import
org.apache.shardingsphere.test.e2e.env.container.atomic.adapter.config.AdaptorContainerConfiguration;
+import
org.apache.shardingsphere.test.e2e.env.container.atomic.constants.ProxyContainerConstants;
+import
org.apache.shardingsphere.test.e2e.env.container.atomic.util.StorageContainerUtils;
+import
org.apache.shardingsphere.test.e2e.env.container.wait.JdbcConnectionWaitStrategy;
+import org.apache.shardingsphere.test.e2e.env.runtime.DataSourceEnvironment;
+import org.testcontainers.containers.GenericContainer;
+import org.testcontainers.lifecycle.Startable;
+import org.testcontainers.utility.Base58;
+
+import javax.sql.DataSource;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * ShardingSphere proxy internal container.
+ * todo Reset static properties when closing the class., like
PipelineAPIFactory#GOVERNANCE_FACADE_MAP
+ */
+@Slf4j
+public final class ShardingSphereProxyContainer implements AdapterContainer,
EmbeddedITContainer {
+
+ private static final String OS_MAC_TMP_DIR = "/tmp";
+
+ private static final String E2E_PROXY_CONFIG_TMP_DIR_PREFIX =
"e2e-shardingsphere-proxy-config";
+
+ private final DatabaseType databaseType;
+
+ private final AdaptorContainerConfiguration config;
+
+ private final AtomicReference<DataSource> targetDataSourceProvider = new
AtomicReference<>();
+
+ private final Set<Startable> dependencies = new HashSet<>();
+
+ @Setter
+ private String abbreviation =
ProxyContainerConstants.PROXY_CONTAINER_ABBREVIATION;
+
+ private ShardingSphereProxy proxy;
+
+ public ShardingSphereProxyContainer(final DatabaseType databaseType, final
AdaptorContainerConfiguration config) {
+ this.databaseType = databaseType;
+ this.config = config;
+ }
+
+ @Override
+ public DataSource getTargetDataSource(final String serverLists) {
+ DataSource dataSource = targetDataSourceProvider.get();
+ if (null == dataSource) {
+
targetDataSourceProvider.set(StorageContainerUtils.generateDataSource(DataSourceEnvironment.getURL(databaseType,
"127.0.0.1", 3307, config.getProxyDataSourceName()),
+ ProxyContainerConstants.USERNAME,
ProxyContainerConstants.PASSWORD));
+ }
+ return targetDataSourceProvider.get();
+ }
+
+ @Override
+ public String getAbbreviation() {
+ return abbreviation;
+ }
+
+ @Override
+ public Set<Startable> getDependencies() {
+ return dependencies;
+ }
+
+ /**
+ * Depends on.
+ *
+ * @param dependencies dependencies
+ */
+ public void dependsOn(final Startable... dependencies) {
+ Collections.addAll(this.dependencies, dependencies);
+ }
+
+ private void startDependencies() {
+ getDependencies().forEach(Startable::start);
+ }
+
+ @SneakyThrows
+ @Override
+ public void start() {
+ startDependencies();
+ startInternalProxy();
+ new JdbcConnectionWaitStrategy(() ->
getTargetDataSource(null).getConnection()).waitUntilReady(null);
+ }
+
+ @SneakyThrows
+ private void startInternalProxy() {
+ YamlProxyConfiguration yamlConfig =
ProxyConfigurationLoader.load(getTempConfigDirectory().toString());
+ int port =
Integer.parseInt(ConfigurationPropertyKey.PROXY_DEFAULT_PORT.getDefaultValue());
+ new BootstrapInitializer().init(yamlConfig, port, false);
+ ProxySSLContext.init();
+ proxy = new ShardingSphereProxy();
+ proxy.startInternal(port, Collections.singletonList("0.0.0.0"));
+ log.info("DBPlusEngine-Proxy {} mode started successfully",
ProxyContext.getInstance().getContextManager().getComputeNodeInstanceContext().getModeConfiguration().getType());
+ }
+
+ private Path getTempConfigDirectory() throws IOException {
+ Map<String, String> aliasAndHostLinkMap = getAliasAndHostLinkMap();
+ Path tempDirectory = createTempDirectory().toPath();
+ for (Map.Entry<String, String> each :
config.getMountedResources().entrySet()) {
+ String content =
IOUtils.toString(Objects.requireNonNull(ShardingSphereProxyContainer.class.getClassLoader().getResourceAsStream(each.getKey())),
StandardCharsets.UTF_8);
+ for (Map.Entry<String, String> entry :
aliasAndHostLinkMap.entrySet()) {
+ content = content.replace(entry.getKey(), entry.getValue());
+ }
+ File tempFile =
tempDirectory.resolve(Paths.get(each.getKey()).getFileName()).toFile();
+ tempFile.deleteOnExit();
+ try (FileWriter writer = new FileWriter(tempFile)) {
+ writer.write(content);
+ }
+ }
+ return tempDirectory;
+ }
+
+ private Map<String, String> getAliasAndHostLinkMap() {
+ Map<String, String> result = new HashMap<>();
+ for (Startable each : dependencies) {
+ if (each instanceof GenericContainer) {
+ result.putAll(getAliasAndHostLinkMap((GenericContainer<?>)
each));
+ }
+ }
+ return result;
+ }
+
+ private Map<String, String> getAliasAndHostLinkMap(final
GenericContainer<?> genericContainer) {
+ Map<String, String> result = new HashMap<>();
+ for (String each : genericContainer.getNetworkAliases()) {
+ for (Integer exposedPort : genericContainer.getExposedPorts()) {
+ result.put(each + ":" + exposedPort, "127.0.0.1:" +
genericContainer.getMappedPort(exposedPort));
+ }
+ }
+ return result;
+ }
+
+ private File createTempDirectory() {
+ try {
+ if (SystemUtils.IS_OS_MAC) {
+ return Files.createTempDirectory(Paths.get(OS_MAC_TMP_DIR),
E2E_PROXY_CONFIG_TMP_DIR_PREFIX).toFile();
+ }
+ return
Files.createTempDirectory(E2E_PROXY_CONFIG_TMP_DIR_PREFIX).toFile();
+ } catch (final IOException ex) {
+ return new File(E2E_PROXY_CONFIG_TMP_DIR_PREFIX +
Base58.randomString(5));
+ }
+ }
+
+ @Override
+ public void stop() {
+ proxy.close();
+ }
+}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
index 8b306e2f61a..7812f9a130a 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java
@@ -41,6 +41,7 @@ import
org.apache.shardingsphere.single.yaml.config.YamlSingleRuleConfiguration;
import
org.apache.shardingsphere.test.e2e.data.pipeline.command.ExtraSQLCommand;
import
org.apache.shardingsphere.test.e2e.data.pipeline.env.PipelineE2EEnvironment;
import
org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTypeEnum;
+import
org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineProxyTypeEnum;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.container.compose.BaseContainerComposer;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.container.compose.DockerContainerComposer;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.container.compose.NativeContainerComposer;
@@ -243,7 +244,7 @@ public final class PipelineContainerComposer implements
AutoCloseable {
String registerStorageUnitTemplate = "REGISTER STORAGE UNIT ${ds} (
URL='${url}', USER='${user}', PASSWORD='${password}')".replace("${ds}",
storageUnitName)
.replace("${user}", username)
.replace("${password}", getPassword())
- .replace("${url}", getActualJdbcUrlTemplate(storageUnitName,
true));
+ .replace("${url}", getActualJdbcUrlTemplate(storageUnitName,
PipelineE2EEnvironment.getInstance().getItProxyType() ==
PipelineProxyTypeEnum.NONE));
proxyExecuteWithLog(registerStorageUnitTemplate, 0);
int timeout = databaseType instanceof OpenGaussDatabaseType ? 60 : 10;
Awaitility.await().ignoreExceptions().atMost(timeout,
TimeUnit.SECONDS).pollInterval(3L, TimeUnit.SECONDS).until(() ->
showStorageUnitsName().contains(storageUnitName));
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/PipelineE2EEnvironment.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/PipelineE2EEnvironment.java
index 102f9a2dc58..380273f536d 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/PipelineE2EEnvironment.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/PipelineE2EEnvironment.java
@@ -22,6 +22,7 @@ import lombok.Getter;
import lombok.SneakyThrows;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import
org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTypeEnum;
+import
org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineProxyTypeEnum;
import
org.apache.shardingsphere.test.e2e.env.container.atomic.storage.impl.MariaDBContainer;
import
org.apache.shardingsphere.test.e2e.env.container.atomic.storage.impl.MySQLContainer;
import
org.apache.shardingsphere.test.e2e.env.container.atomic.storage.impl.OpenGaussContainer;
@@ -44,6 +45,8 @@ public final class PipelineE2EEnvironment {
private final PipelineEnvTypeEnum itEnvType;
+ private final PipelineProxyTypeEnum itProxyType;
+
private final List<String> mysqlVersions;
private final List<String> mariadbVersions;
@@ -57,6 +60,7 @@ public final class PipelineE2EEnvironment {
private PipelineE2EEnvironment() {
props = loadProperties();
itEnvType =
PipelineEnvTypeEnum.valueOf(props.getProperty("pipeline.it.env.type",
PipelineEnvTypeEnum.NONE.name()).toUpperCase());
+ itProxyType =
PipelineProxyTypeEnum.valueOf(props.getProperty("pipeline.it.proxy.type",
PipelineProxyTypeEnum.NONE.name()).toUpperCase());
mysqlVersions =
Arrays.stream(props.getOrDefault("pipeline.it.docker.mysql.version",
"").toString().split(",")).filter(each ->
!Strings.isNullOrEmpty(each)).collect(Collectors.toList());
mariadbVersions =
Arrays.stream(props.getOrDefault("pipeline.it.docker.mariadb.version",
"").toString().split(",")).filter(each ->
!Strings.isNullOrEmpty(each)).collect(Collectors.toList());
postgresqlVersions =
Arrays.stream(props.getOrDefault("pipeline.it.docker.postgresql.version",
"").toString().split(",")).filter(cs ->
!Strings.isNullOrEmpty(cs)).collect(Collectors.toList());
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/enums/PipelineProxyTypeEnum.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/enums/PipelineProxyTypeEnum.java
new file mode 100644
index 00000000000..0e8e8720c69
--- /dev/null
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/env/enums/PipelineProxyTypeEnum.java
@@ -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.
+ */
+
+package org.apache.shardingsphere.test.e2e.data.pipeline.env.enums;
+
+public enum PipelineProxyTypeEnum {
+
+ NONE, INTERNAL
+}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/compose/DockerContainerComposer.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/compose/DockerContainerComposer.java
index 006a809f841..142fc7fc9fb 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/compose/DockerContainerComposer.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/compose/DockerContainerComposer.java
@@ -22,10 +22,13 @@ import
org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.database.mysql.type.MySQLDatabaseType;
import org.apache.shardingsphere.infra.database.oracle.type.OracleDatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import
org.apache.shardingsphere.test.e2e.data.pipeline.env.PipelineE2EEnvironment;
+import
org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineProxyTypeEnum;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.container.config.proxy.PipelineProxyClusterContainerConfigurationFactory;
import
org.apache.shardingsphere.test.e2e.data.pipeline.util.DockerImageVersion;
import
org.apache.shardingsphere.test.e2e.env.container.atomic.adapter.config.AdaptorContainerConfiguration;
import
org.apache.shardingsphere.test.e2e.env.container.atomic.adapter.impl.ShardingSphereProxyClusterContainer;
+import
org.apache.shardingsphere.test.e2e.env.container.atomic.adapter.impl.ShardingSphereProxyContainer;
import
org.apache.shardingsphere.test.e2e.env.container.atomic.governance.GovernanceContainer;
import
org.apache.shardingsphere.test.e2e.env.container.atomic.governance.impl.ZookeeperContainer;
import
org.apache.shardingsphere.test.e2e.env.container.atomic.storage.DockerStorageContainer;
@@ -46,7 +49,7 @@ public final class DockerContainerComposer extends
BaseContainerComposer {
private final DatabaseType databaseType;
- private final ShardingSphereProxyClusterContainer proxyContainer;
+ private ShardingSphereProxyClusterContainer proxyContainer;
@Getter
private final List<DockerStorageContainer> storageContainers = new
LinkedList<>();
@@ -71,19 +74,36 @@ public final class DockerContainerComposer extends
BaseContainerComposer {
}
AdaptorContainerConfiguration containerConfig =
PipelineProxyClusterContainerConfigurationFactory.newInstance(databaseType);
DatabaseType proxyDatabaseType = databaseType instanceof
OracleDatabaseType ? TypedSPILoader.getService(DatabaseType.class, "MySQL") :
databaseType;
- ShardingSphereProxyClusterContainer proxyClusterContainer = new
ShardingSphereProxyClusterContainer(proxyDatabaseType, containerConfig);
- for (DockerStorageContainer each : storageContainers) {
- proxyClusterContainer.dependsOn(governanceContainer, each);
+ if (PipelineE2EEnvironment.getInstance().getItProxyType() ==
PipelineProxyTypeEnum.INTERNAL) {
+ ShardingSphereProxyContainer proxyContainer = new
ShardingSphereProxyContainer(proxyDatabaseType, containerConfig);
+ for (DockerStorageContainer each : storageContainers) {
+ proxyContainer.dependsOn(governanceContainer, each);
+ }
+ getContainers().registerContainer(proxyContainer);
+ } else {
+ ShardingSphereProxyClusterContainer proxyClusterContainer = new
ShardingSphereProxyClusterContainer(proxyDatabaseType, containerConfig);
+ for (DockerStorageContainer each : storageContainers) {
+ proxyClusterContainer.dependsOn(governanceContainer, each);
+ }
+ proxyContainer =
getContainers().registerContainer(proxyClusterContainer);
}
- proxyContainer =
getContainers().registerContainer(proxyClusterContainer);
}
@Override
public String getProxyJdbcUrl(final String databaseName) {
+ String host;
+ int port;
+ if (PipelineE2EEnvironment.getInstance().getItProxyType() ==
PipelineProxyTypeEnum.INTERNAL) {
+ host = "127.0.0.1";
+ port = 3307;
+ } else {
+ host = proxyContainer.getHost();
+ port = proxyContainer.getFirstMappedPort();
+ }
if (databaseType instanceof OracleDatabaseType) {
- return
DataSourceEnvironment.getURL(TypedSPILoader.getService(DatabaseType.class,
"MySQL"), proxyContainer.getHost(), proxyContainer.getFirstMappedPort(),
databaseName);
+ return
DataSourceEnvironment.getURL(TypedSPILoader.getService(DatabaseType.class,
"MySQL"), host, port, databaseName);
}
- return DataSourceEnvironment.getURL(databaseType,
proxyContainer.getHost(), proxyContainer.getFirstMappedPort(), databaseName);
+ return DataSourceEnvironment.getURL(databaseType, host, port,
databaseName);
}
@Override
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/config/proxy/PipelineProxyClusterContainerConfigurationFactory.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/config/proxy/PipelineProxyClusterContainerConfigurationFactory.java
index d036dfcd696..de1088ea9af 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/config/proxy/PipelineProxyClusterContainerConfigurationFactory.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/container/config/proxy/PipelineProxyClusterContainerConfigurationFactory.java
@@ -54,8 +54,8 @@ public final class
PipelineProxyClusterContainerConfigurationFactory {
private static Map<String, String> getMountedResource(final DatabaseType
databaseType) {
Map<String, String> result = new HashMap<>(2, 1F);
result.putAll(ProxyClusterContainerConfigurationFactory.newInstance().getMountedResources());
- result.put(String.format("/env/%s/global.yaml",
databaseType.getType().toLowerCase()),
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "global.yaml");
- result.put("/env/logback.xml",
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "logback.xml");
+ result.put(String.format("env/%s/global.yaml",
databaseType.getType().toLowerCase()),
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "global.yaml");
+ result.put("env/logback.xml",
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "logback.xml");
return result;
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/resources/env/it-env.properties
b/test/e2e/operation/pipeline/src/test/resources/env/it-env.properties
index b367ad83f8e..e21c893d003 100644
--- a/test/e2e/operation/pipeline/src/test/resources/env/it-env.properties
+++ b/test/e2e/operation/pipeline/src/test/resources/env/it-env.properties
@@ -16,6 +16,7 @@
#
# pipeline.it.type=NONE,DOCKER,NATIVE
pipeline.it.env.type=NONE
+#pipeline.it.proxy.type=INTERNAL
# pipeline.it.docker.mysql.version=mysql:5.7,mysql:8.0
pipeline.it.docker.mysql.version=
#
pipeline.it.docker.postgresql.version=postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine