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 782b43a19e5 Rename PipelineProxyType (#36724)
782b43a19e5 is described below
commit 782b43a19e5580ef7a1f12f3416b3b9072def036
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Sep 27 00:55:06 2025 +0800
Rename PipelineProxyType (#36724)
---
.../storage/type/DockerStorageContainer.java | 1 +
.../pipeline/cases/PipelineContainerComposer.java | 23 ++++++++++++++--------
.../pipeline/env/PipelineE2EEnvironment.java | 5 ++---
...neProxyTypeEnum.java => PipelineProxyType.java} | 4 ++--
.../docker/PipelineDockerContainerComposer.java | 6 +++---
.../src/test/resources/env/e2e-env.properties | 2 +-
6 files changed, 24 insertions(+), 17 deletions(-)
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/storage/type/DockerStorageContainer.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/storage/type/DockerStorageContainer.java
index 8ce5e9f783d..97dcb25765e 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/storage/type/DockerStorageContainer.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/container/storage/type/DockerStorageContainer.java
@@ -59,6 +59,7 @@ public final class DockerStorageContainer extends
DockerE2EContainer implements
private final String scenario;
+ @Getter
private final int majorVersion;
@Getter
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/PipelineContainerComposer.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/PipelineContainerComposer.java
index 1d2a6a951e9..2d3bb673513 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/PipelineContainerComposer.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/PipelineContainerComposer.java
@@ -43,7 +43,6 @@ import
org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootConfiguration;
import
org.apache.shardingsphere.single.yaml.config.YamlSingleRuleConfiguration;
import
org.apache.shardingsphere.test.e2e.env.container.constants.ProxyContainerConstants;
import
org.apache.shardingsphere.test.e2e.env.container.constants.StorageContainerConstants;
-import
org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerConnectOption;
import
org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import
org.apache.shardingsphere.test.e2e.env.container.storage.type.DockerStorageContainer;
import
org.apache.shardingsphere.test.e2e.env.container.util.StorageContainerUtils;
@@ -51,7 +50,7 @@ import
org.apache.shardingsphere.test.e2e.env.runtime.E2ETestEnvironment;
import org.apache.shardingsphere.test.e2e.env.runtime.type.RunEnvironment.Type;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.command.ExtraSQLCommand;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineE2EEnvironment;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineProxyTypeEnum;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineProxyType;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.PipelineBaseContainerComposer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.docker.PipelineDockerContainerComposer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.natived.PipelineNativeContainerComposer;
@@ -256,7 +255,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,
PipelineE2EEnvironment.getInstance().getItProxyType() ==
PipelineProxyTypeEnum.NONE));
+ .replace("${url}", getActualJdbcUrlTemplate(storageUnitName,
PipelineE2EEnvironment.getInstance().getProxyType() == PipelineProxyType.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));
@@ -282,14 +281,22 @@ public final class PipelineContainerComposer implements
AutoCloseable {
* @return actual JDBC URL template
*/
public String getActualJdbcUrlTemplate(final String databaseName, final
boolean isInContainer, final int storageContainerIndex) {
- StorageContainerConnectOption option =
DatabaseTypedSPILoader.getService(StorageContainerOption.class,
databaseType).getConnectOption();
+ StorageContainerOption option =
DatabaseTypedSPILoader.getService(StorageContainerOption.class, databaseType);
if (Type.DOCKER ==
E2ETestEnvironment.getInstance().getRunEnvironment().getType()) {
DockerStorageContainer storageContainer =
((PipelineDockerContainerComposer)
containerComposer).getStorageContainers().get(storageContainerIndex);
- return isInContainer
- ?
option.getURL(storageContainer.getNetworkAliases().get(0),
storageContainer.getExposedPort(), databaseName)
- : storageContainer.getJdbcUrl(databaseName);
+ String toBeConnectedDataSourceName =
Strings.isNullOrEmpty(databaseName) ?
option.getCreateOption().getDefaultDatabaseName(storageContainer.getMajorVersion()).orElse("")
: databaseName;
+ String host;
+ int port;
+ if (isInContainer) {
+ host = storageContainer.getNetworkAliases().get(0);
+ port = storageContainer.getExposedPort();
+ } else {
+ host = storageContainer.getHost();
+ port = storageContainer.getMappedPort();
+ }
+ return option.getConnectOption().getURL(host, port,
toBeConnectedDataSourceName);
}
- return option.getURL("127.0.0.1",
E2ETestEnvironment.getInstance().getNativeStorageEnvironment().getPort(databaseType),
databaseName);
+ return option.getConnectOption().getURL("127.0.0.1",
E2ETestEnvironment.getInstance().getNativeStorageEnvironment().getPort(databaseType),
databaseName);
}
/**
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/PipelineE2EEnvironment.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/PipelineE2EEnvironment.java
index 060415c7f9d..78a43a60214 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/PipelineE2EEnvironment.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/PipelineE2EEnvironment.java
@@ -23,7 +23,6 @@ import
org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import org.apache.shardingsphere.test.e2e.env.runtime.E2ETestEnvironment;
import
org.apache.shardingsphere.test.e2e.env.runtime.EnvironmentPropertiesLoader;
import org.apache.shardingsphere.test.e2e.env.runtime.type.RunEnvironment;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineProxyTypeEnum;
import java.util.Arrays;
import java.util.Collections;
@@ -38,11 +37,11 @@ public final class PipelineE2EEnvironment {
private final Properties props;
- private final PipelineProxyTypeEnum itProxyType;
+ private final PipelineProxyType proxyType;
private PipelineE2EEnvironment() {
props = EnvironmentPropertiesLoader.loadProperties();
- itProxyType =
PipelineProxyTypeEnum.valueOf(props.getProperty("pipeline.e2e.proxy.type",
PipelineProxyTypeEnum.NONE.name()).toUpperCase());
+ proxyType =
PipelineProxyType.valueOf(props.getProperty("e2e.pipeline.proxy.type",
PipelineProxyType.NONE.name()).toUpperCase());
}
/**
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/enums/PipelineProxyTypeEnum.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/PipelineProxyType.java
similarity index 95%
rename from
test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/enums/PipelineProxyTypeEnum.java
rename to
test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/PipelineProxyType.java
index 9fb02904de5..e8d6e08c221 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/enums/PipelineProxyTypeEnum.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/PipelineProxyType.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums;
+package org.apache.shardingsphere.test.e2e.operation.pipeline.env;
-public enum PipelineProxyTypeEnum {
+public enum PipelineProxyType {
NONE, INTERNAL
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/docker/PipelineDockerContainerComposer.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/docker/PipelineDockerContainerComposer.java
index 4dcb96218fb..b8647848313 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/docker/PipelineDockerContainerComposer.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/container/compose/docker/PipelineDockerContainerComposer.java
@@ -30,7 +30,7 @@ import
org.apache.shardingsphere.test.e2e.env.container.governance.option.Govern
import
org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
import
org.apache.shardingsphere.test.e2e.env.container.storage.type.DockerStorageContainer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineE2EEnvironment;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineProxyTypeEnum;
+import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineProxyType;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.compose.PipelineBaseContainerComposer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.container.config.proxy.PipelineProxyContainerConfigurationFactory;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.util.ProxyDatabaseTypeUtils;
@@ -64,7 +64,7 @@ public final class PipelineDockerContainerComposer extends
PipelineBaseContainer
}
AdaptorContainerConfiguration containerConfig =
PipelineProxyContainerConfigurationFactory.newInstance(databaseType);
DatabaseType proxyDatabaseType =
ProxyDatabaseTypeUtils.getProxyDatabaseType(databaseType);
- if (PipelineProxyTypeEnum.INTERNAL ==
PipelineE2EEnvironment.getInstance().getItProxyType()) {
+ if (PipelineProxyType.INTERNAL ==
PipelineE2EEnvironment.getInstance().getProxyType()) {
ShardingSphereProxyEmbeddedContainer proxyContainer = new
ShardingSphereProxyEmbeddedContainer(proxyDatabaseType, containerConfig);
for (DockerStorageContainer each : storageContainers) {
proxyContainer.dependsOn(governanceContainer, each);
@@ -83,7 +83,7 @@ public final class PipelineDockerContainerComposer extends
PipelineBaseContainer
public String getProxyJdbcUrl(final String databaseName) {
String host;
int port;
- if (PipelineProxyTypeEnum.INTERNAL ==
PipelineE2EEnvironment.getInstance().getItProxyType()) {
+ if (PipelineProxyType.INTERNAL ==
PipelineE2EEnvironment.getInstance().getProxyType()) {
host = "127.0.0.1";
port = 3307;
} else {
diff --git
a/test/e2e/operation/pipeline/src/test/resources/env/e2e-env.properties
b/test/e2e/operation/pipeline/src/test/resources/env/e2e-env.properties
index 4c581b07845..cbbddf5a460 100644
--- a/test/e2e/operation/pipeline/src/test/resources/env/e2e-env.properties
+++ b/test/e2e/operation/pipeline/src/test/resources/env/e2e-env.properties
@@ -17,7 +17,7 @@
#e2e.run.type=DOCKER,NATIVE
e2e.run.type=
-#pipeline.e2e.proxy.type=INTERNAL
+#e2e.pipeline.proxy.type=INTERNAL
#e2e.artifact.database.mysql.image=mysql:5.7,mysql:8.0
e2e.artifact.database.mysql.image=