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 f7325f48752 Add E2ETestEnvironment.governanceCenter (#36434)
f7325f48752 is described below
commit f7325f48752938e6586e56e534ba9703a317e1c0
Author: Liang Zhang <[email protected]>
AuthorDate: Sat Aug 30 14:05:29 2025 +0800
Add E2ETestEnvironment.governanceCenter (#36434)
* Add E2ETestEnvironment.governanceCenter
* Add E2ETestEnvironment.governanceCenter
* Add E2ETestEnvironment.governanceCenter
* Add E2ETestEnvironment.governanceCenter
---
.../test/e2e/env/runtime/E2ETestEnvironment.java | 4 ++
.../SQLE2EProxyContainerConfigurationFactory.java | 14 ++++--
.../env/common/cluster/proxy/conf/logback.xml | 33 --------------
.../common/{standalone/proxy/conf => }/logback.xml | 2 +-
.../env/common/standalone/proxy/conf/global.yaml | 12 -----
.../proxy/mode/cluster/{ => zookeeper}/global.yaml | 0
.../proxy/mode/cluster/{ => zookeeper}/global.yaml | 0
.../proxy/mode/cluster/{ => zookeeper}/global.yaml | 0
.../proxy/mode/cluster/{ => zookeeper}/global.yaml | 0
.../proxy/mode/cluster/{ => zookeeper}/global.yaml | 0
.../proxy/mode/cluster/{ => zookeeper}/global.yaml | 0
.../proxy/mode/cluster/global.yaml | 52 ----------------------
.../mode/cluster/mysql/{ => zookeeper}/global.yaml | 0
.../cluster/opengauss/{ => zookeeper}/global.yaml | 0
.../cluster/postgresql/{ => zookeeper}/global.yaml | 0
.../proxy/mode/cluster/{ => zookeeper}/global.yaml | 0
16 files changed, 16 insertions(+), 101 deletions(-)
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/E2ETestEnvironment.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/E2ETestEnvironment.java
index aa6527e8cc3..96f49fa3e47 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/E2ETestEnvironment.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/E2ETestEnvironment.java
@@ -18,6 +18,7 @@
package org.apache.shardingsphere.test.e2e.env.runtime;
import com.google.common.base.Splitter;
+import com.google.common.base.Strings;
import lombok.Getter;
import
org.apache.shardingsphere.test.e2e.env.runtime.cluster.ClusterEnvironment;
import
org.apache.shardingsphere.test.e2e.env.runtime.scenario.path.ScenarioCommonPath;
@@ -42,6 +43,8 @@ public final class E2ETestEnvironment {
private final Collection<String> scenarios;
+ private final String governanceCenter;
+
private final ClusterEnvironment clusterEnvironment;
private final boolean smoke;
@@ -66,6 +69,7 @@ public final class E2ETestEnvironment {
nativeStoragePort = props.getProperty("it.native.storage.port");
nativeStorageUsername =
props.getProperty("it.native.storage.username");
nativeStoragePassword =
props.getProperty("it.native.storage.password");
+ governanceCenter =
Strings.isNullOrEmpty(props.getProperty("it.env.governance.center")) ?
"ZooKeeper" : props.getProperty("it.env.governance.center");
}
@SuppressWarnings("AccessOfSystemProperties")
diff --git
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/container/config/SQLE2EProxyContainerConfigurationFactory.java
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/container/config/SQLE2EProxyContainerConfigurationFactory.java
index a33dbb144c5..0dd6d4342ac 100644
---
a/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/container/config/SQLE2EProxyContainerConfigurationFactory.java
+++
b/test/e2e/sql/src/test/java/org/apache/shardingsphere/test/e2e/env/container/config/SQLE2EProxyContainerConfigurationFactory.java
@@ -23,7 +23,7 @@ import
org.apache.shardingsphere.database.connector.core.type.DatabaseType;
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.AdapterContainerUtils;
-import org.jetbrains.annotations.NotNull;
+import org.apache.shardingsphere.test.e2e.env.runtime.E2ETestEnvironment;
import java.net.URL;
import java.util.HashMap;
@@ -50,14 +50,16 @@ public final class SQLE2EProxyContainerConfigurationFactory
{
private static Map<String, String> getMountedResources(final String
scenario, final String modeType, final DatabaseType databaseType) {
Map<String, String> result = new HashMap<>(3, 1F);
- result.put(String.format("/env/common/%s/proxy/conf/logback.xml",
modeType), ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "logback.xml");
+ result.put("/env/common/logback.xml",
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "logback.xml");
result.put(String.format("/env/scenario/%s/proxy/conf/%s", scenario,
databaseType.getType().toLowerCase()),
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER);
result.put(getGlobalYamlPath(scenario, modeType, databaseType),
ProxyContainerConstants.CONFIG_PATH_IN_CONTAINER + "global.yaml");
return result;
}
- @NotNull
private static String getGlobalYamlPath(final String scenario, final
String modeType, final DatabaseType databaseType) {
+ if (isGovernanceCenterGlobalYamlExists(scenario, modeType)) {
+ return
String.format("/env/scenario/%s/proxy/mode/%s/%s/global.yaml", scenario,
modeType, E2ETestEnvironment.getInstance().getGovernanceCenter().toLowerCase());
+ }
if (isDialectScenarioGlobalYamlExists(scenario, modeType,
databaseType)) {
return
String.format("/env/scenario/%s/proxy/mode/%s/%s/global.yaml", scenario,
modeType, databaseType.getType().toLowerCase());
}
@@ -67,6 +69,12 @@ public final class SQLE2EProxyContainerConfigurationFactory {
return String.format("/env/common/%s/proxy/conf/global.yaml",
modeType);
}
+ private static boolean isGovernanceCenterGlobalYamlExists(final String
scenario, final String modeType) {
+ URL url = Thread.currentThread().getContextClassLoader().getResource(
+ String.format("env/scenario/%s/proxy/mode/%s/%s/global.yaml",
scenario, modeType,
E2ETestEnvironment.getInstance().getGovernanceCenter().toLowerCase()));
+ return null != url;
+ }
+
private static boolean isDialectScenarioGlobalYamlExists(final String
scenario, final String modeType, final DatabaseType databaseType) {
URL url =
Thread.currentThread().getContextClassLoader().getResource(String.format("env/scenario/%s/proxy/mode/%s/%s/global.yaml",
scenario, modeType, databaseType.getType().toLowerCase()));
return null != url;
diff --git
a/test/e2e/sql/src/test/resources/env/common/cluster/proxy/conf/logback.xml
b/test/e2e/sql/src/test/resources/env/common/cluster/proxy/conf/logback.xml
deleted file mode 100644
index 1494746120c..00000000000
--- a/test/e2e/sql/src/test/resources/env/common/cluster/proxy/conf/logback.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.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.
- -->
-
-<configuration>
- <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
- <encoder>
- <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread]
%logger{36} - %msg%n</pattern>
- </encoder>
- </appender>
- <logger name="org.apache.shardingsphere" level="info" additivity="false">
- <appender-ref ref="console" />
- </logger>
-
- <root>
- <level value="info" />
- <appender-ref ref="console" />
- </root>
-</configuration>
diff --git
a/test/e2e/sql/src/test/resources/env/common/standalone/proxy/conf/logback.xml
b/test/e2e/sql/src/test/resources/env/common/logback.xml
similarity index 98%
rename from
test/e2e/sql/src/test/resources/env/common/standalone/proxy/conf/logback.xml
rename to test/e2e/sql/src/test/resources/env/common/logback.xml
index 1494746120c..4f4c963e960 100644
---
a/test/e2e/sql/src/test/resources/env/common/standalone/proxy/conf/logback.xml
+++ b/test/e2e/sql/src/test/resources/env/common/logback.xml
@@ -30,4 +30,4 @@
<level value="info" />
<appender-ref ref="console" />
</root>
-</configuration>
+</configuration>
diff --git
a/test/e2e/sql/src/test/resources/env/common/standalone/proxy/conf/global.yaml
b/test/e2e/sql/src/test/resources/env/common/standalone/proxy/conf/global.yaml
index 199f2a1e8f7..35dbce0ae4b 100644
---
a/test/e2e/sql/src/test/resources/env/common/standalone/proxy/conf/global.yaml
+++
b/test/e2e/sql/src/test/resources/env/common/standalone/proxy/conf/global.yaml
@@ -15,18 +15,6 @@
# limitations under the License.
#
-#mode:
-# type: Cluster
-# repository:
-# type: ZooKeeper
-# props:
-# namespace: it_db
-# server-lists: zk.host:2181
-# timeToLiveSeconds: 60
-# operationTimeoutMilliseconds: 500
-# retryIntervalMilliseconds: 500
-# maxRetries: 3
-
authority:
users:
- user: proxy
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/db/proxy/mode/cluster/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/db/proxy/mode/cluster/zookeeper/global.yaml
similarity index 100%
rename from
test/e2e/sql/src/test/resources/env/scenario/db/proxy/mode/cluster/global.yaml
rename to
test/e2e/sql/src/test/resources/env/scenario/db/proxy/mode/cluster/zookeeper/global.yaml
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/db_tbl_sql_federation/proxy/mode/cluster/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/db_tbl_sql_federation/proxy/mode/cluster/zookeeper/global.yaml
similarity index 100%
rename from
test/e2e/sql/src/test/resources/env/scenario/db_tbl_sql_federation/proxy/mode/cluster/global.yaml
rename to
test/e2e/sql/src/test/resources/env/scenario/db_tbl_sql_federation/proxy/mode/cluster/zookeeper/global.yaml
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting/proxy/mode/cluster/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting/proxy/mode/cluster/zookeeper/global.yaml
similarity index 100%
rename from
test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting/proxy/mode/cluster/global.yaml
rename to
test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting/proxy/mode/cluster/zookeeper/global.yaml
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/mode/cluster/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/mode/cluster/zookeeper/global.yaml
similarity index 100%
rename from
test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/mode/cluster/global.yaml
rename to
test/e2e/sql/src/test/resources/env/scenario/dbtbl_with_readwrite_splitting_and_encrypt/proxy/mode/cluster/zookeeper/global.yaml
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/distsql_rdl/proxy/mode/cluster/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/distsql_rdl/proxy/mode/cluster/zookeeper/global.yaml
similarity index 100%
rename from
test/e2e/sql/src/test/resources/env/scenario/distsql_rdl/proxy/mode/cluster/global.yaml
rename to
test/e2e/sql/src/test/resources/env/scenario/distsql_rdl/proxy/mode/cluster/zookeeper/global.yaml
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/empty_rules/proxy/mode/cluster/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/empty_rules/proxy/mode/cluster/zookeeper/global.yaml
similarity index 100%
rename from
test/e2e/sql/src/test/resources/env/scenario/empty_rules/proxy/mode/cluster/global.yaml
rename to
test/e2e/sql/src/test/resources/env/scenario/empty_rules/proxy/mode/cluster/zookeeper/global.yaml
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/global.yaml
deleted file mode 100644
index ccba03734f6..00000000000
---
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/global.yaml
+++ /dev/null
@@ -1,52 +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.
-#
-
-mode:
- type: Cluster
- repository:
- type: ZooKeeper
- props:
- namespace: it_empty_storage_units
- server-lists: zk.host:2181
- timeToLiveSeconds: 60
- operationTimeoutMilliseconds: 500
- retryIntervalMilliseconds: 500
- maxRetries: 3
-
-authority:
- users:
- - user: proxy
- password: Proxy@123
- admin: true
- privilege:
- type: ALL_PERMITTED
-
-sqlParser:
- sqlStatementCache:
- initialCapacity: 2000
- maximumSize: 65535
- parseTreeCache:
- initialCapacity: 128
- maximumSize: 1024
-
-props:
- max-connections-size-per-query: 1
- kernel-executor-size: 16 # Infinite by default.
- proxy-frontend-flush-threshold: 128 # The default value is 128.
- sql-show: false
-# proxy-frontend-ssl-enabled: true
- proxy-meta-data-collector-enabled: true
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/mysql/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/mysql/zookeeper/global.yaml
similarity index 100%
rename from
test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/mysql/global.yaml
rename to
test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/mysql/zookeeper/global.yaml
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/opengauss/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/opengauss/zookeeper/global.yaml
similarity index 100%
rename from
test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/opengauss/global.yaml
rename to
test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/opengauss/zookeeper/global.yaml
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/postgresql/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/postgresql/zookeeper/global.yaml
similarity index 100%
rename from
test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/postgresql/global.yaml
rename to
test/e2e/sql/src/test/resources/env/scenario/empty_storage_units/proxy/mode/cluster/postgresql/zookeeper/global.yaml
diff --git
a/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/mode/cluster/global.yaml
b/test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/mode/cluster/zookeeper/global.yaml
similarity index 100%
rename from
test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/mode/cluster/global.yaml
rename to
test/e2e/sql/src/test/resources/env/scenario/sharding_and_encrypt/proxy/mode/cluster/zookeeper/global.yaml