This is an automated email from the ASF dual-hosted git repository.
zhonghongsheng 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 997ffd693b4 Improve pipeline E2E isEnabled (#37746)
997ffd693b4 is described below
commit 997ffd693b4eb3d97d3eb30ddfa7dd03b1663587
Author: Hongsheng Zhong <[email protected]>
AuthorDate: Thu Jan 15 19:12:35 2026 +0800
Improve pipeline E2E isEnabled (#37746)
---
.../test/e2e/operation/pipeline/cases/cdc/CDCE2EIT.java | 7 +++----
.../cases/createtable/CreateTableSQLGeneratorIT.java | 7 +++----
.../migration/general/MySQLMigrationGeneralE2EIT.java | 7 +++----
.../migration/general/MySQLTimeTypesMigrationE2EIT.java | 7 +++----
.../migration/general/PostgreSQLMigrationGeneralE2EIT.java | 7 +++----
.../migration/general/PostgreSQLToMySQLMigrationE2EIT.java | 7 +++----
.../cases/migration/general/RollbackMigrationE2EIT.java | 7 +++----
.../cases/migration/general/RulesMigrationE2EIT.java | 7 +++----
.../cases/migration/primarykey/IndexesMigrationE2EIT.java | 7 +++----
.../cases/migration/primarykey/MariaDBMigrationE2EIT.java | 7 +++----
.../migration/primarykey/TextPrimaryKeyMigrationE2EIT.java | 8 +++-----
.../pipeline/framework/param/PipelineE2ECondition.java | 14 ++++++++++----
12 files changed, 43 insertions(+), 49 deletions(-)
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/cdc/CDCE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/cdc/CDCE2EIT.java
index 4175d57b31e..a6b39b1ee03 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/cdc/CDCE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/cdc/CDCE2EIT.java
@@ -38,7 +38,6 @@ import
org.apache.shardingsphere.data.pipeline.core.metadata.loader.StandardPipe
import
org.apache.shardingsphere.data.pipeline.core.metadata.model.PipelineColumnMetaData;
import
org.apache.shardingsphere.data.pipeline.core.metadata.model.PipelineTableMetaData;
import
org.apache.shardingsphere.database.connector.core.metadata.database.metadata.DialectDatabaseMetaData;
-import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.database.connector.core.type.DatabaseTypeRegistry;
import
org.apache.shardingsphere.infra.algorithm.keygen.snowflake.SnowflakeKeyGenerateAlgorithm;
import org.apache.shardingsphere.infra.metadata.database.schema.QualifiedTable;
@@ -55,6 +54,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import
org.apache.shardingsphere.test.e2e.operation.pipeline.util.DataSourceExecuteUtils;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -202,8 +202,7 @@ class CDCE2EIT {
assertTrue(checkResult.isMatched());
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"MySQL"),
- TypedSPILoader.getService(DatabaseType.class, "PostgreSQL"),
TypedSPILoader.getService(DatabaseType.class, "openGauss"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/createtable/CreateTableSQLGeneratorIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/createtable/CreateTableSQLGeneratorIT.java
index 7819e7a2014..ff6806b79c0 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/createtable/CreateTableSQLGeneratorIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/createtable/CreateTableSQLGeneratorIT.java
@@ -20,7 +20,6 @@ package
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.createtable;
import
org.apache.shardingsphere.data.pipeline.core.sqlbuilder.dialect.DialectPipelineSQLBuilder;
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.StorageContainerOption;
import
org.apache.shardingsphere.test.e2e.env.container.storage.type.DockerStorageContainer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.entity.CreateTableSQLGeneratorAssertionEntity;
@@ -33,6 +32,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineTestParameter;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -115,8 +115,7 @@ class CreateTableSQLGeneratorIT {
return result;
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"MySQL"),
- TypedSPILoader.getService(DatabaseType.class, "PostgreSQL"),
TypedSPILoader.getService(DatabaseType.class, "openGauss"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
index 0773ce43a3c..8c7bad4323b 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
@@ -21,9 +21,7 @@ import com.google.common.collect.ImmutableMap;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
-import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.infra.algorithm.keygen.snowflake.SnowflakeKeyGenerateAlgorithm;
-import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
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.cases.task.E2EIncrementalTask;
@@ -36,6 +34,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import
org.apache.shardingsphere.test.e2e.operation.pipeline.util.DataSourceExecuteUtils;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -113,7 +112,7 @@ class MySQLMigrationGeneralE2EIT extends
AbstractMigrationE2EIT {
assertCheckMigrationSuccess(containerComposer, jobId, algorithmType,
algorithmProps);
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"MySQL"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/MySQLTimeTypesMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/MySQLTimeTypesMigrationE2EIT.java
index 5636a811fb2..df9c720d60a 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/MySQLTimeTypesMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/MySQLTimeTypesMigrationE2EIT.java
@@ -18,8 +18,6 @@
package
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.migration.general;
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.operation.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.migration.AbstractMigrationE2EIT;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineE2ECondition;
@@ -27,6 +25,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineE2ETestCaseArgumentsProvider;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineTestParameter;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -74,7 +73,7 @@ class MySQLTimeTypesMigrationE2EIT extends
AbstractMigrationE2EIT {
}
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"MySQL"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
index f501fd4829a..d816381c8f5 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
@@ -21,9 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.tuple.Pair;
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.algorithm.keygen.snowflake.SnowflakeKeyGenerateAlgorithm;
-import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
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.cases.task.E2EIncrementalTask;
@@ -36,6 +34,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import
org.apache.shardingsphere.test.e2e.operation.pipeline.util.DataSourceExecuteUtils;
import org.awaitility.Awaitility;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -131,7 +130,7 @@ class PostgreSQLMigrationGeneralE2EIT extends
AbstractMigrationE2EIT {
}
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"PostgreSQL"), TypedSPILoader.getService(DatabaseType.class, "openGauss"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
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 694e3707a27..e0c3f9967d7 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
@@ -22,8 +22,6 @@ import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
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.E2ETestEnvironment;
import org.apache.shardingsphere.test.e2e.env.runtime.type.RunEnvironment.Type;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.PipelineContainerComposer;
@@ -36,6 +34,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import org.awaitility.Awaitility;
import org.awaitility.core.ConditionTimeoutException;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
import org.testcontainers.containers.PostgreSQLContainer;
@@ -165,7 +164,7 @@ class PostgreSQLToMySQLMigrationE2EIT extends
AbstractMigrationE2EIT {
}
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"MySQL"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/RollbackMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/RollbackMigrationE2EIT.java
index aaf2f57ec6c..9449d394237 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/RollbackMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/RollbackMigrationE2EIT.java
@@ -18,8 +18,6 @@
package
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.migration.general;
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.operation.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.migration.AbstractMigrationE2EIT;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.helper.PipelineCaseHelper;
@@ -29,6 +27,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineTestParameter;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.util.AutoIncrementKeyGenerateAlgorithm;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -58,7 +57,7 @@ class RollbackMigrationE2EIT extends AbstractMigrationE2EIT {
}
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"MySQL"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/RulesMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/RulesMigrationE2EIT.java
index 86ee27b5342..591d7f5323f 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/RulesMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/general/RulesMigrationE2EIT.java
@@ -18,9 +18,7 @@
package
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.migration.general;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
-import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.infra.algorithm.keygen.uuid.UUIDKeyGenerateAlgorithm;
-import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
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.framework.helper.PipelineCaseHelper;
@@ -30,6 +28,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineE2ETestCaseArgumentsProvider;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineTestParameter;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -95,7 +94,7 @@ class RulesMigrationE2EIT extends AbstractMigrationE2EIT {
assertThat(containerComposer.getTargetTableRecordsCount(containerComposer.getProxyDataSource(),
SOURCE_TABLE_NAME), is(PipelineContainerComposer.TABLE_INIT_ROW_COUNT));
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"MySQL"), TypedSPILoader.getService(DatabaseType.class, "MariaDB"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
index 215d3871550..f53d2633a68 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
@@ -20,14 +20,12 @@ package
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.migration.pr
import lombok.SneakyThrows;
import org.apache.commons.codec.binary.Hex;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
-import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.database.connector.mysql.type.MySQLDatabaseType;
import
org.apache.shardingsphere.database.connector.postgresql.type.PostgreSQLDatabaseType;
import
org.apache.shardingsphere.infra.algorithm.core.context.AlgorithmSQLContext;
import
org.apache.shardingsphere.infra.algorithm.keygen.spi.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.infra.algorithm.keygen.uuid.UUIDKeyGenerateAlgorithm;
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.operation.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.migration.AbstractMigrationE2EIT;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.helper.PipelineCaseHelper;
@@ -38,6 +36,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineTestParameter;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.util.AutoIncrementKeyGenerateAlgorithm;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -255,7 +254,7 @@ class IndexesMigrationE2EIT extends AbstractMigrationE2EIT {
assertTrue(lastJobIds.isEmpty());
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"MySQL"), TypedSPILoader.getService(DatabaseType.class, "PostgreSQL"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
index 6138b3a7132..41e81f4b0ab 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
@@ -18,10 +18,8 @@
package
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.migration.primarykey;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
-import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.infra.algorithm.keygen.spi.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.infra.algorithm.keygen.uuid.UUIDKeyGenerateAlgorithm;
-import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
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.framework.helper.PipelineCaseHelper;
@@ -32,6 +30,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineTestParameter;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -83,7 +82,7 @@ class MariaDBMigrationE2EIT extends AbstractMigrationE2EIT {
}
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"MySQL"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
index 7836ecfa8e5..d48b91ddfe5 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/operation/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
@@ -18,10 +18,8 @@
package
org.apache.shardingsphere.test.e2e.operation.pipeline.cases.migration.primarykey;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
-import org.apache.shardingsphere.database.connector.core.type.DatabaseType;
import
org.apache.shardingsphere.database.connector.mysql.type.MySQLDatabaseType;
import
org.apache.shardingsphere.infra.algorithm.keygen.uuid.UUIDKeyGenerateAlgorithm;
-import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
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.framework.helper.PipelineCaseHelper;
@@ -31,6 +29,7 @@ import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.Pip
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineE2ETestCaseArgumentsProvider;
import
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param.PipelineTestParameter;
import org.junit.jupiter.api.condition.EnabledIf;
+import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ArgumentsSource;
@@ -78,8 +77,7 @@ class TextPrimaryKeyMigrationE2EIT extends
AbstractMigrationE2EIT {
return containerComposer.getDatabaseType() instanceof
MySQLDatabaseType ? "T_ORDER" : "t_order";
}
- private static boolean isEnabled() {
- return
PipelineE2ECondition.isEnabled(TypedSPILoader.getService(DatabaseType.class,
"MySQL"),
- TypedSPILoader.getService(DatabaseType.class, "PostgreSQL"),
TypedSPILoader.getService(DatabaseType.class, "openGauss"));
+ private static boolean isEnabled(final ExtensionContext context) {
+ return PipelineE2ECondition.isEnabled(context);
}
}
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 c96d3c4e6b6..7928c54e840 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
@@ -20,10 +20,14 @@ package
org.apache.shardingsphere.test.e2e.operation.pipeline.framework.param;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
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.E2ETestEnvironment;
import org.apache.shardingsphere.test.e2e.env.runtime.type.RunEnvironment.Type;
+import org.junit.jupiter.api.extension.ExtensionContext;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.stream.Collectors;
/**
* Pipeline E2E condition.
@@ -34,16 +38,18 @@ public final class PipelineE2ECondition {
/**
* Judge whether pipeline E2E is enabled.
*
- * @param databaseTypes database types
+ * @param context extension context
* @return enabled or not
*/
- public static boolean isEnabled(final DatabaseType... databaseTypes) {
+ public static boolean isEnabled(final ExtensionContext context) {
if (null ==
E2ETestEnvironment.getInstance().getRunEnvironment().getType()) {
return false;
}
- if (0 != databaseTypes.length && Type.NATIVE ==
E2ETestEnvironment.getInstance().getRunEnvironment().getType()) {
+ PipelineE2ESettings settings =
context.getRequiredTestClass().getAnnotation(PipelineE2ESettings.class);
+ Collection<DatabaseType> databaseTypes =
Arrays.stream(settings.database()).map(each ->
TypedSPILoader.getService(DatabaseType.class,
each.type())).collect(Collectors.toList());
+ if (!databaseTypes.isEmpty() && Type.NATIVE ==
E2ETestEnvironment.getInstance().getRunEnvironment().getType()) {
return true;
}
- return 0 == databaseTypes.length ||
Arrays.stream(databaseTypes).anyMatch(each ->
!E2ETestEnvironment.getInstance().getDockerEnvironment().getDatabaseImages(each).isEmpty());
+ return databaseTypes.isEmpty() || databaseTypes.stream().anyMatch(each
->
!E2ETestEnvironment.getInstance().getDockerEnvironment().getDatabaseImages(each).isEmpty());
}
}