From 3df4a208ce0d3888a650136cb30e2e9570b14cbe Mon Sep 17 00:00:00 2001 From: Xinze Guo <101622833+azexcy@users.noreply.github.com> Date: Tue, 24 Oct 2023 20:54:19 +0800 Subject: [PATCH] Enable cdc e2e (#28854) --- .../pipeline/cases/PipelineContainerComposer.java | 2 +- .../test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java | 11 ++--------- .../pipeline/src/test/resources/logback-test.xml | 2 +- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java index fa86987e48918..bc73fafdeb43f 100644 --- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java +++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/PipelineContainerComposer.java @@ -561,7 +561,7 @@ public void assertGreaterThanOrderTableInitRows(final DataSource dataSource, fin */ // TODO proxy support for some fields still needs to be optimized, such as binary of MySQL, after these problems are optimized, Proxy dataSource can be used. public DataSource generateShardingSphereDataSourceFromProxy() { - Awaitility.await().atMost(5L, TimeUnit.SECONDS).pollInterval(1L, TimeUnit.SECONDS).until(() -> null != getYamlRootConfig().getRules()); + Awaitility.await().atMost(10L, TimeUnit.SECONDS).pollInterval(1L, TimeUnit.SECONDS).until(() -> null != getYamlRootConfig().getRules()); YamlRootConfiguration rootConfig = getYamlRootConfig(); ShardingSpherePreconditions.checkNotNull(rootConfig.getDataSources(), () -> new IllegalStateException("dataSources is null")); ShardingSpherePreconditions.checkNotNull(rootConfig.getRules(), () -> new IllegalStateException("rules is null")); diff --git a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java index c4d2337a2f565..5f586cc8d4b47 100644 --- a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java +++ b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java @@ -44,8 +44,6 @@ import org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm; import org.apache.shardingsphere.test.e2e.data.pipeline.cases.PipelineContainerComposer; import org.apache.shardingsphere.test.e2e.data.pipeline.cases.task.E2EIncrementalTask; -import org.apache.shardingsphere.test.e2e.data.pipeline.env.PipelineE2EEnvironment; -import org.apache.shardingsphere.test.e2e.data.pipeline.env.enums.PipelineEnvTypeEnum; import org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper; import org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineE2ECondition; import org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineE2ESettings; @@ -54,7 +52,6 @@ import org.apache.shardingsphere.test.e2e.data.pipeline.framework.param.PipelineTestParameter; import org.apache.shardingsphere.test.e2e.data.pipeline.util.DataSourceExecuteUtils; import org.apache.shardingsphere.test.e2e.env.container.atomic.constants.ProxyContainerConstants; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.condition.EnabledIf; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ArgumentsSource; @@ -80,7 +77,6 @@ /** * CDC E2E IT. */ -@Disabled("TODO Enable MySQL after compatible with com.mysql:mysql-connector-j:8.0") @PipelineE2ESettings(database = { @PipelineE2EDatabaseSettings(type = "MySQL", scenarioFiles = "env/scenario/general/mysql.xml"), @PipelineE2EDatabaseSettings(type = "PostgreSQL", scenarioFiles = "env/scenario/general/postgresql.xml"), @@ -101,10 +97,7 @@ class CDCE2EIT { @EnabledIf("isEnabled") @ArgumentsSource(PipelineE2ETestCaseArgumentsProvider.class) void assertCDCDataImportSuccess(final PipelineTestParameter testParam) throws SQLException, InterruptedException { - if (TimeZone.getDefault() != TimeZone.getTimeZone("UTC") && PipelineEnvTypeEnum.DOCKER == PipelineE2EEnvironment.getInstance().getItEnvType()) { - // make sure the time zone of locally running program same with the database server at CI. - TimeZone.setDefault(TimeZone.getTimeZone("UTC")); - } + TimeZone.setDefault(TimeZone.getTimeZone("UTC")); try (PipelineContainerComposer containerComposer = new PipelineContainerComposer(testParam, new CDCJobType())) { for (String each : Arrays.asList(PipelineContainerComposer.DS_0, PipelineContainerComposer.DS_1)) { containerComposer.registerStorageUnit(each); @@ -113,7 +106,7 @@ void assertCDCDataImportSuccess(final PipelineTestParameter testParam) throws SQ try (Connection connection = containerComposer.getProxyDataSource().getConnection()) { initSchemaAndTable(containerComposer, connection, 3); } - DataSource dataSource = containerComposer.getProxyDataSource(); + DataSource dataSource = containerComposer.generateShardingSphereDataSourceFromProxy(); Pair, List> dataPair = PipelineCaseHelper.generateFullInsertData(containerComposer.getDatabaseType(), PipelineContainerComposer.TABLE_INIT_ROW_COUNT); log.info("init data begin: {}", LocalDateTime.now()); DataSourceExecuteUtils.execute(dataSource, containerComposer.getExtraSQLCommand().getFullInsertOrder(SOURCE_TABLE_NAME), dataPair.getLeft()); diff --git a/test/e2e/operation/pipeline/src/test/resources/logback-test.xml b/test/e2e/operation/pipeline/src/test/resources/logback-test.xml index 32f24684b39c8..dcfb014859781 100644 --- a/test/e2e/operation/pipeline/src/test/resources/logback-test.xml +++ b/test/e2e/operation/pipeline/src/test/resources/logback-test.xml @@ -31,4 +31,4 @@ - +