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 16004fca5f5 Merge PipelineEnvTypeEnum and RunEnvironment.Type (#36716)
16004fca5f5 is described below
commit 16004fca5f5beea077e28b9499fef50bfa3db40d
Author: Liang Zhang <[email protected]>
AuthorDate: Fri Sep 26 04:12:00 2025 +0800
Merge PipelineEnvTypeEnum and RunEnvironment.Type (#36716)
* Merge PipelineEnvTypeEnum and RunEnvironment.Type
* Merge PipelineEnvTypeEnum and RunEnvironment.Type
* Merge PipelineEnvTypeEnum and RunEnvironment.Type
* Merge PipelineEnvTypeEnum and RunEnvironment.Type
* Merge PipelineEnvTypeEnum and RunEnvironment.Type
* Merge PipelineEnvTypeEnum and RunEnvironment.Type
* Merge PipelineEnvTypeEnum and RunEnvironment.Type
* Merge PipelineEnvTypeEnum and RunEnvironment.Type
* Merge PipelineEnvTypeEnum and RunEnvironment.Type
---
.github/workflows/e2e-operation.yml | 10 ++++-----
.github/workflows/nightly-e2e-operation.yml | 26 +++++++++++-----------
.../test-manual/pipeline-e2e-test/_index.cn.md | 2 +-
.../test-manual/pipeline-e2e-test/_index.en.md | 2 +-
.../test/e2e/env/runtime/type/RunEnvironment.java | 2 +-
.../pipeline/cases/PipelineContainerComposer.java | 16 ++++++-------
.../cases/migration/AbstractMigrationE2EIT.java | 4 ++--
.../general/PostgreSQLToMySQLMigrationE2EIT.java | 15 ++++++-------
.../pipeline/env/PipelineE2EEnvironment.java | 16 ++++++++-----
.../pipeline/env/enums/PipelineEnvTypeEnum.java | 23 -------------------
.../framework/param/PipelineE2ECondition.java | 3 +--
.../src/test/resources/env/e2e-env.properties | 23 ++++++++++---------
.../engine/base/TransactionBaseE2EIT.java | 11 +++++----
.../TransactionDockerContainerComposer.java | 4 ++--
14 files changed, 72 insertions(+), 85 deletions(-)
diff --git a/.github/workflows/e2e-operation.yml
b/.github/workflows/e2e-operation.yml
index e4efabae4e4..18b2b190cc3 100644
--- a/.github/workflows/e2e-operation.yml
+++ b/.github/workflows/e2e-operation.yml
@@ -59,14 +59,14 @@ jobs:
fail-fast: false
matrix:
operation: [ transaction, pipeline, showprocesslist ]
- image: [ { type: "e2e.docker.mysql.version", version: "mysql:5.7" }, {
type: "e2e.docker.postgresql.version", version: "postgres:12-alpine" }, { type:
"e2e.docker.mariadb.version", version: "mariadb:11" } ]
+ image: [ { type: "e2e.artifact.database.mysql.image", version:
"mysql:5.7" }, { type: "e2e.artifact.database.postgresql.image", version:
"postgres:12-alpine" }, { type: "e2e.artifact.database.mariadb.image", version:
"mariadb:11" } ]
exclude:
- operation: transaction
- image: { type: "e2e.docker.mariadb.version", version: "mariadb:11"
}
+ image: { type: "e2e.artifact.database.mariadb.image", version:
"mariadb:11" }
- operation: showprocesslist
- image: { type: "e2e.docker.postgresql.version", version:
"postgres:12-alpine" }
+ image: { type: "e2e.artifact.database.postgresql.image", version:
"postgres:12-alpine" }
- operation: showprocesslist
- image: { type: "e2e.docker.mariadb.version", version: "mariadb:11"
}
+ image: { type: "e2e.artifact.database.mariadb.image", version:
"mariadb:11" }
steps:
- env:
changed_operations: ${{
needs.detect-changed-files.outputs.changed_operations }}
@@ -107,4 +107,4 @@ jobs:
run: ./mvnw -B clean install -am -pl test/e2e/operation/${{
matrix.operation }} -Pe2e.env.docker -DskipTests
- name: Run ${{ matrix.operation }} on ${{ matrix.image.version }}
if: (env.skip_current_step == 'false')
- run: ./mvnw -nsu -B install -f test/e2e/operation/${{ matrix.operation
}}/pom.xml -D${{ matrix.operation }}.e2e.env.type=docker -D${{ matrix.operation
}}.${{ matrix.image.type }}=${{ matrix.image.version }}
+ run: ./mvnw -nsu -B install -f test/e2e/operation/${{ matrix.operation
}}/pom.xml -De2e.run.type=docker -D${{ matrix.image.type }}=${{
matrix.image.version }}
diff --git a/.github/workflows/nightly-e2e-operation.yml
b/.github/workflows/nightly-e2e-operation.yml
index a4466d0ab6a..97583c121bd 100644
--- a/.github/workflows/nightly-e2e-operation.yml
+++ b/.github/workflows/nightly-e2e-operation.yml
@@ -47,24 +47,24 @@ jobs:
java-version: [ 11, 21 ]
operation: [ transaction, pipeline, showprocesslist ]
image: [
- { type: "e2e.docker.mysql.version", version: "mysql:5.7" },
- { type: "e2e.docker.mysql.version", version: "mysql:8.0" },
- { type: "e2e.docker.mariadb.version", version: "mariadb:11" },
- { type: "e2e.docker.postgresql.version", version:
"postgres:11-alpine" },
- { type: "e2e.docker.postgresql.version", version:
"postgres:12-alpine" },
- { type: "e2e.docker.postgresql.version", version:
"postgres:13-alpine" },
- { type: "e2e.docker.postgresql.version", version:
"postgres:14-alpine" },
- { type: "e2e.docker.opengauss.version", version:
"opengauss/opengauss:3.1.0" }
+ { type: "e2e.artifact.database.mysql.image", version: "mysql:5.7" },
+ { type: "e2e.artifact.database.mysql.image", version: "mysql:8.0" },
+ { type: "e2e.artifact.database.mariadb.image", version: "mariadb:11"
},
+ { type: "e2e.artifact.database.postgresql.image", version:
"postgres:11-alpine" },
+ { type: "e2e.artifact.database.postgresql.image", version:
"postgres:12-alpine" },
+ { type: "e2e.artifact.database.postgresql.image", version:
"postgres:13-alpine" },
+ { type: "e2e.artifact.database.postgresql.image", version:
"postgres:14-alpine" },
+ { type: "e2e.artifact.database.opengauss.image", version:
"opengauss/opengauss:3.1.0" }
]
exclude:
- operation: transaction
- image: { type: "e2e.docker.mariadb.version", version: "mariadb:11"
}
+ image: { type: "e2e.artifact.database.mariadb.image", version:
"mariadb:11" }
- operation: showprocesslist
- image: { type: "e2e.docker.mariadb.version", version: "mariadb:11"
}
+ image: { type: "e2e.artifact.database.mariadb.image", version:
"mariadb:11" }
- operation: showprocesslist
- image: { type: "e2e.docker.postgresql.version", version:
"postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine"
}
+ image: { type: "e2e.artifact.database.postgresql.image", version:
"postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine"
}
- operation: showprocesslist
- image: { type: "e2e.docker.opengauss.version", version:
"opengauss/opengauss:3.1.0" }
+ image: { type: "e2e.artifact.database.opengauss.image", version:
"opengauss/opengauss:3.1.0" }
steps:
- uses: actions/checkout@v4
- name: Retrieve Maven Caches
@@ -83,4 +83,4 @@ jobs:
- name: Build ${{ matrix.operation }} E2E Image
run: ./mvnw -B clean install -am -pl test/e2e/operation/${{
matrix.operation }} -Pe2e.env.docker -DskipTests
- name: Run ${{ matrix.operation }} on ${{ matrix.image.version }}
- run: ./mvnw -nsu -B install -f test/e2e/operation/${{ matrix.operation
}}/pom.xml -D${{ matrix.operation }}.e2e.env.type=docker -D${{ matrix.operation
}}.${{ matrix.image.type }}=${{ matrix.image.version }}
+ run: ./mvnw -nsu -B install -f test/e2e/operation/${{ matrix.operation
}}/pom.xml -De2e.run.type=docker -D${{ matrix.image.type }}=${{
matrix.image.version }}
diff --git a/docs/document/content/test-manual/pipeline-e2e-test/_index.cn.md
b/docs/document/content/test-manual/pipeline-e2e-test/_index.cn.md
index fea1a4c206c..1dbe140d18d 100644
--- a/docs/document/content/test-manual/pipeline-e2e-test/_index.cn.md
+++ b/docs/document/content/test-manual/pipeline-e2e-test/_index.cn.md
@@ -62,7 +62,7 @@ Proxy 配置可以参考:
3. 以 MySQL 为例,`e2e-env.properties` 可以配置如下:
```
-pipeline.e2e.env.type=NATIVE
+e2e.run.type=NATIVE
pipeline.e2e.native.database=mysql
pipeline.e2e.native.mysql.username=root
pipeline.e2e.native.mysql.password=root
diff --git a/docs/document/content/test-manual/pipeline-e2e-test/_index.en.md
b/docs/document/content/test-manual/pipeline-e2e-test/_index.en.md
index ff7d7a08cbe..d63266d56a0 100644
--- a/docs/document/content/test-manual/pipeline-e2e-test/_index.en.md
+++ b/docs/document/content/test-manual/pipeline-e2e-test/_index.en.md
@@ -61,7 +61,7 @@ Refer to following files for proxy `global.yaml`
configuration:
3. Take MySQL as an example, `e2e-env.properties` could be configured as
follows:
```
-pipeline.e2e.env.type=NATIVE
+e2e.run.type=NATIVE
pipeline.e2e.native.database=mysql
pipeline.e2e.native.mysql.username=root
pipeline.e2e.native.mysql.password=root
diff --git
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/RunEnvironment.java
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/RunEnvironment.java
index 2b5228e1664..4b89fe76fc8 100644
---
a/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/RunEnvironment.java
+++
b/test/e2e/env/src/test/java/org/apache/shardingsphere/test/e2e/env/runtime/type/RunEnvironment.java
@@ -42,7 +42,7 @@ public final class RunEnvironment {
private Type getType(final Properties props) {
String value = props.getProperty("e2e.run.type");
- return Strings.isNullOrEmpty(value) ? null : Type.valueOf(value);
+ return Strings.isNullOrEmpty(value) ? null :
Type.valueOf(value.toUpperCase());
}
/**
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 6d92ea6e5f3..4bd5312f383 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
@@ -47,9 +47,9 @@ import
org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageCo
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;
+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.PipelineEnvTypeEnum;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineProxyTypeEnum;
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;
@@ -124,10 +124,10 @@ public final class PipelineContainerComposer implements
AutoCloseable {
public PipelineContainerComposer(final PipelineTestParameter testParam,
final PipelineJobType jobType) {
databaseType = testParam.getDatabaseType();
- containerComposer =
PipelineE2EEnvironment.getInstance().getItEnvType() ==
PipelineEnvTypeEnum.DOCKER
+ containerComposer = Type.DOCKER ==
PipelineE2EEnvironment.getInstance().getType()
? new
PipelineDockerContainerComposer(testParam.getDatabaseType(),
testParam.getStorageContainerImage(), testParam.getStorageContainerCount())
: new
PipelineNativeContainerComposer(testParam.getDatabaseType());
- if (PipelineE2EEnvironment.getInstance().getItEnvType() ==
PipelineEnvTypeEnum.DOCKER) {
+ if (Type.DOCKER == PipelineE2EEnvironment.getInstance().getType()) {
username = StorageContainerConstants.OPERATION_USER;
password = StorageContainerConstants.OPERATION_PASSWORD;
} else {
@@ -156,7 +156,7 @@ public final class PipelineContainerComposer implements
AutoCloseable {
}
private void cleanUpPipelineJobs(final Connection connection, final
PipelineJobType jobType) throws SQLException {
- if (PipelineEnvTypeEnum.NATIVE !=
PipelineE2EEnvironment.getInstance().getItEnvType()) {
+ if (Type.NATIVE != PipelineE2EEnvironment.getInstance().getType()) {
return;
}
String jobTypeName = jobType.getType();
@@ -196,7 +196,7 @@ public final class PipelineContainerComposer implements
AutoCloseable {
}
private void cleanUpProxyDatabase(final Connection connection) {
- if (PipelineEnvTypeEnum.NATIVE !=
PipelineE2EEnvironment.getInstance().getItEnvType()) {
+ if (Type.NATIVE != PipelineE2EEnvironment.getInstance().getType()) {
return;
}
try (Statement statement = connection.createStatement()) {
@@ -217,7 +217,7 @@ public final class PipelineContainerComposer implements
AutoCloseable {
}
private void cleanUpDataSource() {
- if (PipelineEnvTypeEnum.NATIVE !=
PipelineE2EEnvironment.getInstance().getItEnvType()) {
+ if (Type.NATIVE != PipelineE2EEnvironment.getInstance().getType()) {
return;
}
DatabaseTypeRegistry databaseTypeRegistry = new
DatabaseTypeRegistry(databaseType);
@@ -281,7 +281,7 @@ public final class PipelineContainerComposer implements
AutoCloseable {
*/
public String getActualJdbcUrlTemplate(final String databaseName, final
boolean isInContainer, final int storageContainerIndex) {
StorageContainerConnectOption option =
DatabaseTypedSPILoader.getService(StorageContainerOption.class,
databaseType).getConnectOption();
- if (PipelineEnvTypeEnum.DOCKER ==
PipelineE2EEnvironment.getInstance().getItEnvType()) {
+ if (Type.DOCKER == PipelineE2EEnvironment.getInstance().getType()) {
DockerStorageContainer storageContainer =
((PipelineDockerContainerComposer)
containerComposer).getStorageContainers().get(storageContainerIndex);
return isInContainer
?
option.getURL(storageContainer.getNetworkAliases().get(0),
storageContainer.getExposedPort(), databaseName)
@@ -617,7 +617,7 @@ public final class PipelineContainerComposer implements
AutoCloseable {
YamlRootConfiguration rootConfig = getYamlRootConfig();
ShardingSpherePreconditions.checkNotNull(rootConfig.getDataSources(),
() -> new IllegalStateException("dataSources is null"));
ShardingSpherePreconditions.checkNotNull(rootConfig.getRules(), () ->
new IllegalStateException("rules is null"));
- if (PipelineEnvTypeEnum.DOCKER ==
PipelineE2EEnvironment.getInstance().getItEnvType()) {
+ if (Type.DOCKER == PipelineE2EEnvironment.getInstance().getType()) {
DockerStorageContainer storageContainer =
((PipelineDockerContainerComposer)
containerComposer).getStorageContainers().get(0);
String sourceUrl = String.join(":",
storageContainer.getNetworkAliases().get(0),
Integer.toString(storageContainer.getExposedPort()));
String targetUrl = String.join(":", storageContainer.getHost(),
Integer.toString(storageContainer.getMappedPort()));
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/AbstractMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/AbstractMigrationE2EIT.java
index bde6edc7349..28ebd01d338 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/AbstractMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/AbstractMigrationE2EIT.java
@@ -22,10 +22,10 @@ import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.database.connector.opengauss.type.OpenGaussDatabaseType;
import
org.apache.shardingsphere.database.connector.postgresql.type.PostgreSQLDatabaseType;
+import org.apache.shardingsphere.test.e2e.env.runtime.type.RunEnvironment.Type;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.command.MigrationDistSQLCommand;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineE2EEnvironment;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineEnvTypeEnum;
import org.awaitility.Awaitility;
import org.opengauss.util.PSQLException;
@@ -56,7 +56,7 @@ public abstract class AbstractMigrationE2EIT {
}
protected void addMigrationSourceResource(final PipelineContainerComposer
containerComposer) throws SQLException {
- if (PipelineEnvTypeEnum.NATIVE ==
PipelineE2EEnvironment.getInstance().getItEnvType()) {
+ if (Type.NATIVE == PipelineE2EEnvironment.getInstance().getType()) {
try {
containerComposer.proxyExecuteWithLog("UNREGISTER MIGRATION
SOURCE STORAGE UNIT ds_0", 2);
} catch (final SQLException ex) {
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/PostgreSQLToMySQLMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/PostgreSQLToMySQLMigrationE2EIT.java
index cf695b11875..ff08714af90 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/PostgreSQLToMySQLMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/PostgreSQLToMySQLMigrationE2EIT.java
@@ -25,10 +25,10 @@ import
org.apache.shardingsphere.data.pipeline.core.job.JobStatus;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.test.e2e.env.runtime.type.RunEnvironment.Type;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.migration.AbstractMigrationE2EIT;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineE2EEnvironment;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineEnvTypeEnum;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineE2ECondition;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineE2ESettings;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineE2ESettings.PipelineE2EDatabaseSettings;
@@ -64,12 +64,12 @@ class PostgreSQLToMySQLMigrationE2EIT extends
AbstractMigrationE2EIT {
void assertMigrationSuccess(final PipelineTestParameter testParam) throws
SQLException {
PostgreSQLContainer<?> postgresqlContainer = null;
try (PipelineContainerComposer containerComposer = new
PipelineContainerComposer(testParam, new MigrationJobType())) {
- if (PipelineEnvTypeEnum.DOCKER ==
PipelineE2EEnvironment.getInstance().getItEnvType()) {
+ if (Type.DOCKER == PipelineE2EEnvironment.getInstance().getType())
{
postgresqlContainer = new PostgreSQLContainer<>("postgres:13");
postgresqlContainer.withNetwork(containerComposer.getContainerComposer().getContainers().getNetwork()).withNetworkAliases("postgresql.host")
.withDatabaseName("postgres").withUsername("postgres").withPassword("postgres").withCommand("-c
wal_level=logical").start();
}
- String jdbcUrl =
PipelineE2EEnvironment.getInstance().getItEnvType() ==
PipelineEnvTypeEnum.DOCKER ? postgresqlContainer.getJdbcUrl() :
"jdbc:postgresql://localhost:5432/postgres";
+ String jdbcUrl = Type.DOCKER ==
PipelineE2EEnvironment.getInstance().getType() ?
postgresqlContainer.getJdbcUrl() : "jdbc:postgresql://localhost:5432/postgres";
initSourceTable(jdbcUrl);
registerMigrationSourceStorageUnit(containerComposer);
containerComposer.registerStorageUnit(PipelineContainerComposer.DS_0);
@@ -97,9 +97,9 @@ class PostgreSQLToMySQLMigrationE2EIT extends
AbstractMigrationE2EIT {
}
private void initSourceTable(final String jdbcUrl) throws SQLException {
- PipelineEnvTypeEnum itEnvType =
PipelineE2EEnvironment.getInstance().getItEnvType();
+ Type type = PipelineE2EEnvironment.getInstance().getType();
try (Connection connection = DriverManager.getConnection(jdbcUrl,
"postgres", "postgres")) {
- if (PipelineEnvTypeEnum.NATIVE == itEnvType) {
+ if (Type.NATIVE == type) {
connection.createStatement().execute("DROP TABLE IF EXISTS
t_order;");
}
String createTableSQL = "CREATE TABLE t_order (order_id BIGINT
PRIMARY KEY,user_id INT,status VARCHAR(32), c_datetime TIMESTAMP,c_date
DATE,c_time TIME,c_bytea BYTEA,"
@@ -124,15 +124,14 @@ class PostgreSQLToMySQLMigrationE2EIT extends
AbstractMigrationE2EIT {
}
private void registerMigrationSourceStorageUnit(final
PipelineContainerComposer containerComposer) throws SQLException {
- if (PipelineEnvTypeEnum.NATIVE ==
PipelineE2EEnvironment.getInstance().getItEnvType()) {
+ if (Type.NATIVE == PipelineE2EEnvironment.getInstance().getType()) {
try {
containerComposer.proxyExecuteWithLog("UNREGISTER MIGRATION
SOURCE STORAGE UNIT source_ds", 2);
} catch (final SQLException ex) {
log.warn("Unregister migration source storage unit `source_ds`
failed, maybe it does not exist. Error msg: {}", ex.getMessage());
}
}
- String jdbcUrl = String.format("jdbc:postgresql://%s:5432/postgres",
- PipelineE2EEnvironment.getInstance().getItEnvType() ==
PipelineEnvTypeEnum.DOCKER ? "postgresql.host" : "localhost");
+ String jdbcUrl = String.format("jdbc:postgresql://%s:5432/postgres",
Type.DOCKER == PipelineE2EEnvironment.getInstance().getType() ?
"postgresql.host" : "localhost");
String sql = String.format("REGISTER MIGRATION SOURCE STORAGE UNIT
source_ds (URL='%s', USER='postgres', PASSWORD='postgres')", jdbcUrl);
containerComposer.proxyExecuteWithLog(sql, 2);
}
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 9f56afa55ca..86a003d43b8 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
@@ -24,7 +24,8 @@ import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoa
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.test.e2e.env.container.constants.StorageContainerConstants;
import
org.apache.shardingsphere.test.e2e.env.container.storage.option.StorageContainerOption;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineEnvTypeEnum;
+import org.apache.shardingsphere.test.e2e.env.runtime.type.RunEnvironment;
+import org.apache.shardingsphere.test.e2e.env.runtime.type.RunEnvironment.Type;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineProxyTypeEnum;
import java.io.IOException;
@@ -42,13 +43,13 @@ public final class PipelineE2EEnvironment {
private final Properties props;
- private final PipelineEnvTypeEnum itEnvType;
+ private final Type type;
private final PipelineProxyTypeEnum itProxyType;
private PipelineE2EEnvironment() {
props = loadProperties();
- itEnvType =
PipelineEnvTypeEnum.valueOf(props.getProperty("pipeline.e2e.env.type",
PipelineEnvTypeEnum.NONE.name()).toUpperCase());
+ type = getType(props);
itProxyType =
PipelineProxyTypeEnum.valueOf(props.getProperty("pipeline.e2e.proxy.type",
PipelineProxyTypeEnum.NONE.name()).toUpperCase());
}
@@ -64,6 +65,11 @@ public final class PipelineE2EEnvironment {
return result;
}
+ private Type getType(final Properties props) {
+ String value = props.getProperty("e2e.run.type");
+ return Strings.isNullOrEmpty(value) ? null :
Type.valueOf(value.toUpperCase());
+ }
+
/**
* Get actual database port.
*
@@ -121,10 +127,10 @@ public final class PipelineE2EEnvironment {
*/
public List<String> listStorageContainerImages(final DatabaseType
databaseType) {
// Native mode needn't use docker image, just return a list which
contain one item
- if (PipelineEnvTypeEnum.NATIVE == itEnvType) {
+ if (RunEnvironment.Type.NATIVE == type) {
return
databaseType.getType().equalsIgnoreCase(getNativeDatabaseType()) ?
Collections.singletonList("") : Collections.emptyList();
}
- return
Arrays.stream(props.getOrDefault(String.format("pipeline.e2e.docker.%s.version",
databaseType.getType().toLowerCase()), "").toString()
+ return
Arrays.stream(props.getOrDefault(String.format("e2e.artifact.database.%s.image",
databaseType.getType().toLowerCase()), "").toString()
.split(",")).filter(each ->
!Strings.isNullOrEmpty(each)).collect(Collectors.toList());
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/enums/PipelineEnvTypeEnum.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/enums/PipelineEnvTypeEnum.java
deleted file mode 100644
index 8e8d6fae602..00000000000
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/env/enums/PipelineEnvTypeEnum.java
+++ /dev/null
@@ -1,23 +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.pipeline.env.enums;
-
-public enum PipelineEnvTypeEnum {
-
- NONE, DOCKER, NATIVE
-}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/param/PipelineE2ECondition.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/param/PipelineE2ECondition.java
index c6ec1423c7a..1ed9eecd237 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/param/PipelineE2ECondition.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/framework/param/PipelineE2ECondition.java
@@ -21,7 +21,6 @@ import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.PipelineE2EEnvironment;
-import
org.apache.shardingsphere.test.e2e.operation.pipeline.env.enums.PipelineEnvTypeEnum;
import java.util.Arrays;
@@ -38,7 +37,7 @@ public final class PipelineE2ECondition {
* @return enabled or not
*/
public static boolean isEnabled(final DatabaseType... databaseTypes) {
- if (PipelineEnvTypeEnum.NONE ==
PipelineE2EEnvironment.getInstance().getItEnvType()) {
+ if (null == PipelineE2EEnvironment.getInstance().getType()) {
return false;
}
return 0 == databaseTypes.length ||
Arrays.stream(databaseTypes).anyMatch(each ->
!PipelineE2EEnvironment.getInstance().listStorageContainerImages(each).isEmpty());
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 709c901544d..49ea1579f2c 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
@@ -13,17 +13,20 @@
# 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.
-#
-# pipeline.e2e.type=NONE,DOCKER,NATIVE
-pipeline.e2e.env.type=NONE
+
+#e2e.run.type=DOCKER,NATIVE
+e2e.run.type=
+
#pipeline.e2e.proxy.type=INTERNAL
-# pipeline.e2e.docker.mysql.version=mysql:5.7,mysql:8.0
-pipeline.e2e.docker.mysql.version=
-#
pipeline.e2e.docker.postgresql.version=postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine
-pipeline.e2e.docker.postgresql.version=
-# pipeline.e2e.docker.opengauss.version=opengauss/opengauss:3.1.0
-pipeline.e2e.docker.opengauss.version=
-# pipeline.e2e.native.database=mysql or postgresql or opengauss
+
+#e2e.artifact.database.mysql.image=mysql:5.7,mysql:8.0
+e2e.artifact.database.mysql.image=
+#e2e.artifact.database.postgresql.image=postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine
+e2e.artifact.database.postgresql.image=
+#e2e.artifact.database.opengauss.image=opengauss/opengauss:3.1.0
+e2e.artifact.database.opengauss.image=
+
+#pipeline.e2e.native.database=mysql or postgresql or opengauss
pipeline.e2e.native.database=
pipeline.e2e.native.mysql.username=root
pipeline.e2e.native.mysql.password=Test@9876
diff --git
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/engine/base/TransactionBaseE2EIT.java
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/engine/base/TransactionBaseE2EIT.java
index ad87c211cd1..13e7c43cb5b 100644
---
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/engine/base/TransactionBaseE2EIT.java
+++
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/engine/base/TransactionBaseE2EIT.java
@@ -18,12 +18,12 @@
package org.apache.shardingsphere.test.e2e.operation.transaction.engine.base;
import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
import lombok.Getter;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.database.connector.core.spi.DatabaseTypedSPILoader;
import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
-import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
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;
@@ -355,13 +355,16 @@ public abstract class TransactionBaseE2EIT {
}
private Collection<TransactionTestParameter> getTestParameters(final
TransactionTestCaseRegistry registry) {
- Map<String, TransactionTestParameter> result = new
LinkedHashMap<>();
if (TEST_CASES.isEmpty()) {
log.warn("Transaction test cases are empty.");
}
String databaseVersion =
ENV.getArtifactEnvironment().getDatabaseImage(registry.getDatabaseType());
+ if (Strings.isNullOrEmpty(databaseVersion)) {
+ return new LinkedList<>();
+ }
+ Map<String, TransactionTestParameter> result = new
LinkedHashMap<>();
for (Class<? extends BaseTransactionTestCase> each : TEST_CASES) {
- if (!TRANSACTION_ENV.getCases().isEmpty() &&
!ENV.getScenarios().contains(each.getSimpleName())) {
+ if (!TRANSACTION_ENV.getCases().isEmpty() &&
!TRANSACTION_ENV.getCases().contains(each.getSimpleName())) {
log.info("Collect transaction test case, need to run cases
don't contain this, skip: {}.", each.getName());
continue;
}
@@ -419,7 +422,7 @@ public abstract class TransactionBaseE2EIT {
private void setTestParameters(final Map<String,
TransactionTestParameter> testParams, final TransactionTestCaseRegistry
registry, final String databaseVersion,
final List<TransactionType>
transactionTypes, final List<String> providers, final String scenario, final
Class<? extends BaseTransactionTestCase> caseClass) {
String key = getUniqueKey(registry.getDatabaseType(),
registry.getRunningAdaptor(), transactionTypes, providers, scenario);
- testParams.putIfAbsent(key, new
TransactionTestParameter(TypedSPILoader.getService(DatabaseType.class,
registry.getDatabaseType()),
+ testParams.putIfAbsent(key, new
TransactionTestParameter(registry.getDatabaseType(),
registry.getRunningAdaptor(),
ENV.getArtifactEnvironment().getProxyPortBindings(), transactionTypes,
providers,
getStorageContainerImageName(registry.getDatabaseType(),
databaseVersion), scenario, new LinkedList<>()));
testParams.get(key).getTransactionTestCaseClasses().add(caseClass);
diff --git
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/framework/container/compose/TransactionDockerContainerComposer.java
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/framework/container/compose/TransactionDockerContainerComposer.java
index 5eca7fc2c7e..888ed347e3f 100644
---
a/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/framework/container/compose/TransactionDockerContainerComposer.java
+++
b/test/e2e/operation/transaction/src/test/java/org/apache/shardingsphere/test/e2e/operation/transaction/framework/container/compose/TransactionDockerContainerComposer.java
@@ -81,8 +81,8 @@ public final class TransactionDockerContainerComposer extends
TransactionBaseCon
getContainers().registerContainer(proxyContainer);
} else {
proxyContainer = null;
- ShardingSphereJdbcEmbeddedContainer jdbcContainer = new
ShardingSphereJdbcEmbeddedContainer(storageContainer,
-
Objects.requireNonNull(getShardingSphereConfigResource(testParam)).getFile());
+ ShardingSphereJdbcEmbeddedContainer jdbcContainer = new
ShardingSphereJdbcEmbeddedContainer(
+ storageContainer,
Objects.requireNonNull(getShardingSphereConfigResource(testParam)).getFile());
this.jdbcContainer =
getContainers().registerContainer(jdbcContainer);
}
}