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 61dbb548657 Merge ShowProcessListEnvironment and E2ETestEnvironment
(#36685)
61dbb548657 is described below
commit 61dbb54865768ab07fc55ac7f523667608904ebf
Author: Liang Zhang <[email protected]>
AuthorDate: Wed Sep 24 18:14:32 2025 +0800
Merge ShowProcessListEnvironment and E2ETestEnvironment (#36685)
---
.../ClusterShowProcessListContainerComposer.java | 15 ++--
.../engine/ShowProcessListE2EIT.java | 13 ++--
.../env/ShowProcessListEnvironment.java | 82 ----------------------
.../parameter/ShowProcessListTestParameter.java | 3 +-
.../src/test/resources/env/e2e-env.properties | 16 ++---
5 files changed, 24 insertions(+), 105 deletions(-)
diff --git
a/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/container/composer/ClusterShowProcessListContainerComposer.java
b/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/container/composer/ClusterShowProcessListContainerComposer.java
index 5d6be00ffb3..6bd010014b5 100644
---
a/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/container/composer/ClusterShowProcessListContainerComposer.java
+++
b/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/container/composer/ClusterShowProcessListContainerComposer.java
@@ -32,8 +32,9 @@ import
org.apache.shardingsphere.test.e2e.env.container.storage.StorageContainer
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.AdapterContainerUtils;
+import org.apache.shardingsphere.test.e2e.env.runtime.E2ETestEnvironment;
import
org.apache.shardingsphere.test.e2e.env.runtime.type.ArtifactEnvironment.Adapter;
-import
org.apache.shardingsphere.test.e2e.operation.showprocesslist.env.ShowProcessListEnvironment;
+import
org.apache.shardingsphere.test.e2e.env.runtime.type.ArtifactEnvironment.Mode;
import
org.apache.shardingsphere.test.e2e.operation.showprocesslist.parameter.ShowProcessListTestParameter;
import javax.sql.DataSource;
@@ -64,9 +65,9 @@ public final class ClusterShowProcessListContainerComposer
implements AutoClosea
AdaptorContainerConfiguration containerConfig = new
AdaptorContainerConfiguration(testParam.getScenario(), new LinkedList<>(),
getMountedResources(testParam.getScenario(),
testParam.getDatabaseType(), testParam.getMode(),
testParam.getRegCenterType()), AdapterContainerUtils.getAdapterContainerImage(),
"");
- String envType =
ShowProcessListEnvironment.getInstance().getType().name();
- jdbcContainer = AdapterContainerFactory.newInstance(Adapter.JDBC,
testParam.getDatabaseType(), testParam.getScenario(), containerConfig,
storageContainer, envType);
- proxyContainer = AdapterContainerFactory.newInstance(Adapter.PROXY,
testParam.getDatabaseType(), testParam.getScenario(), containerConfig,
storageContainer, envType);
+ String type =
E2ETestEnvironment.getInstance().getRunEnvironment().getType().name();
+ jdbcContainer = AdapterContainerFactory.newInstance(Adapter.JDBC,
testParam.getDatabaseType(), testParam.getScenario(), containerConfig,
storageContainer, type);
+ proxyContainer = AdapterContainerFactory.newInstance(Adapter.PROXY,
testParam.getDatabaseType(), testParam.getScenario(), containerConfig,
storageContainer, type);
if (proxyContainer instanceof DockerE2EContainer) {
if (isClusterMode(testParam.getMode())) {
((DockerE2EContainer)
proxyContainer).dependsOn(governanceContainer);
@@ -77,7 +78,7 @@ public final class ClusterShowProcessListContainerComposer
implements AutoClosea
containers.registerContainer(jdbcContainer);
}
- private Map<String, String> getMountedResources(final String scenario,
final DatabaseType databaseType, final String mode, final String refCenterType)
{
+ private Map<String, String> getMountedResources(final String scenario,
final DatabaseType databaseType, final Mode mode, final String refCenterType) {
Map<String, String> result = new HashMap<>(2, 1F);
result.put(isClusterMode(mode) ?
String.format("/env/common/cluster/proxy/%s/conf/", refCenterType.toLowerCase())
: "/env/common/standalone/proxy/conf/",
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER);
@@ -85,8 +86,8 @@ public final class ClusterShowProcessListContainerComposer
implements AutoClosea
return result;
}
- private boolean isClusterMode(final String mode) {
- return "Cluster".equals(mode);
+ private boolean isClusterMode(final Mode mode) {
+ return Mode.CLUSTER == mode;
}
/**
diff --git
a/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/engine/ShowProcessListE2EIT.java
b/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/engine/ShowProcessListE2EIT.java
index 038c795c057..58490309422 100644
---
a/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/engine/ShowProcessListE2EIT.java
+++
b/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/engine/ShowProcessListE2EIT.java
@@ -20,9 +20,10 @@ package
org.apache.shardingsphere.test.e2e.operation.showprocesslist.engine;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.infra.exception.external.sql.type.wrapper.SQLWrapperException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.test.e2e.env.runtime.E2ETestEnvironment;
+import
org.apache.shardingsphere.test.e2e.env.runtime.type.ArtifactEnvironment.Mode;
import org.apache.shardingsphere.test.e2e.env.runtime.type.RunEnvironment;
import
org.apache.shardingsphere.test.e2e.operation.showprocesslist.container.composer.ClusterShowProcessListContainerComposer;
-import
org.apache.shardingsphere.test.e2e.operation.showprocesslist.env.ShowProcessListEnvironment;
import
org.apache.shardingsphere.test.e2e.operation.showprocesslist.parameter.ShowProcessListTestParameter;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.condition.EnabledIf;
@@ -50,7 +51,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
// TODO add jdbc
class ShowProcessListE2EIT {
- private static final ShowProcessListEnvironment ENV =
ShowProcessListEnvironment.getInstance();
+ private static final E2ETestEnvironment ENV =
E2ETestEnvironment.getInstance();
private static final String SELECT_SLEEP = "select sleep(10)";
@@ -114,7 +115,7 @@ class ShowProcessListE2EIT {
}
private static boolean isEnabled() {
- return RunEnvironment.Type.DOCKER == ENV.getType();
+ return RunEnvironment.Type.DOCKER == ENV.getRunEnvironment().getType();
}
private static final class TestCaseArgumentsProvider implements
ArgumentsProvider {
@@ -123,10 +124,8 @@ class ShowProcessListE2EIT {
public Stream<? extends Arguments> provideArguments(final
ParameterDeclarations parameters, final ExtensionContext context) {
Collection<Arguments> result = new LinkedList<>();
for (String each : ENV.getScenarios()) {
- for (String mode : ENV.getModes()) {
- for (String governanceType : ENV.getRegCenterTypes()) {
- result.add(Arguments.of(new
ShowProcessListTestParameter(TypedSPILoader.getService(DatabaseType.class,
"MySQL"), each, mode, governanceType)));
- }
+ for (Mode mode : ENV.getArtifactEnvironment().getModes()) {
+ result.add(Arguments.of(new
ShowProcessListTestParameter(TypedSPILoader.getService(DatabaseType.class,
"MySQL"), each, mode, ENV.getArtifactEnvironment().getRegCenterType())));
}
}
return result.stream();
diff --git
a/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/env/ShowProcessListEnvironment.java
b/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/env/ShowProcessListEnvironment.java
deleted file mode 100644
index 9141f1b43af..00000000000
---
a/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/env/ShowProcessListEnvironment.java
+++ /dev/null
@@ -1,82 +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.e2e.operation.showprocesslist.env;
-
-import com.google.common.base.Splitter;
-import lombok.Getter;
-import lombok.SneakyThrows;
-import org.apache.shardingsphere.test.e2e.env.runtime.type.RunEnvironment.Type;
-import
org.apache.shardingsphere.test.e2e.env.runtime.type.scenario.path.ScenarioCommonPath;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Collection;
-import java.util.Properties;
-
-@Getter
-public final class ShowProcessListEnvironment {
-
- private static final ShowProcessListEnvironment INSTANCE = new
ShowProcessListEnvironment();
-
- private final Properties props;
-
- private final Type type;
-
- private final Collection<String> modes;
-
- private final Collection<String> scenarios;
-
- private final Collection<String> regCenterTypes;
-
- private ShowProcessListEnvironment() {
- props = loadProperties();
- type = Type.valueOf(props.getProperty("showprocesslist.e2e.env.type",
Type.NATIVE.name()).toUpperCase());
- modes =
Splitter.on(",").trimResults().splitToList(props.getProperty("showprocesslist.e2e.artifact.modes",
"Standalone,Cluster"));
- scenarios = getScenarios(props);
- regCenterTypes =
Splitter.on(",").trimResults().splitToList(props.getProperty("showprocesslist.e2e.regcenter"));
- }
-
- @SneakyThrows(IOException.class)
- private Properties loadProperties() {
- Properties result = new Properties();
- try (InputStream inputStream =
Thread.currentThread().getContextClassLoader().getResourceAsStream("env/e2e-env.properties"))
{
- result.load(inputStream);
- }
- for (String each : System.getProperties().stringPropertyNames()) {
- result.setProperty(each, System.getProperty(each));
- }
- return result;
- }
-
- private Collection<String> getScenarios(final Properties props) {
- Collection<String> result =
Splitter.on(",").trimResults().splitToList(props.getProperty("showprocesslist.e2e.scenarios",
"cluster_jdbc_proxy"));
- for (String each : result) {
- new ScenarioCommonPath(each).checkFolderExist();
- }
- return result;
- }
-
- /**
- * Get instance.
- *
- * @return singleton instance
- */
- public static ShowProcessListEnvironment getInstance() {
- return INSTANCE;
- }
-}
diff --git
a/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/parameter/ShowProcessListTestParameter.java
b/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/parameter/ShowProcessListTestParameter.java
index 4a9bc12b1b4..c35c8902edf 100644
---
a/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/parameter/ShowProcessListTestParameter.java
+++
b/test/e2e/operation/showprocesslist/src/test/java/org/apache/shardingsphere/test/e2e/operation/showprocesslist/parameter/ShowProcessListTestParameter.java
@@ -21,6 +21,7 @@ import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
+import
org.apache.shardingsphere.test.e2e.env.runtime.type.ArtifactEnvironment.Mode;
@RequiredArgsConstructor
@Getter
@@ -31,7 +32,7 @@ public final class ShowProcessListTestParameter {
private final String scenario;
- private final String mode;
+ private final Mode mode;
private final String regCenterType;
}
diff --git
a/test/e2e/operation/showprocesslist/src/test/resources/env/e2e-env.properties
b/test/e2e/operation/showprocesslist/src/test/resources/env/e2e-env.properties
index 7f53cba518e..dcadc997ec4 100644
---
a/test/e2e/operation/showprocesslist/src/test/resources/env/e2e-env.properties
+++
b/test/e2e/operation/showprocesslist/src/test/resources/env/e2e-env.properties
@@ -15,11 +15,11 @@
# limitations under the License.
#
-# showprocesslist.e2e.env.type=NATIVE,DOCKER
-showprocesslist.e2e.env.type=NATIVE
-# showprocesslist.e2e.scenarios=cluster_jdbc_proxy
-showprocesslist.e2e.scenarios=cluster_jdbc_proxy
-# showprocesslist.e2e.artifact.modes=Standalone,Cluster
-showprocesslist.e2e.artifact.modes=Standalone,Cluster
-# showprocesslist.e2e.regcenter=Zookeeper
-showprocesslist.e2e.regcenter=Zookeeper
+# e2e.run.type=NATIVE,DOCKER
+e2e.run.type=NATIVE
+# e2e.scenarios=cluster_jdbc_proxy
+e2e.scenarios=cluster_jdbc_proxy
+# e2e.artifact.modes=Standalone,Cluster
+e2e.artifact.modes=Standalone,Cluster
+# e2e.artifact.regcenter=Zookeeper
+e2e.artifact.regcenter=Zookeeper