This is an automated email from the ASF dual-hosted git repository.

gaojun2048 pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-seatunnel.git


The following commit(s) were added to refs/heads/dev by this push:
     new 68d8187e1 [Feature][E2E] enable sqlServer-cdc e2e testcase (#4708)
68d8187e1 is described below

commit 68d8187e11c579401ea95f73f404cba372656418
Author: ZhilinLi <[email protected]>
AuthorDate: Tue May 9 10:41:58 2023 +0800

    [Feature][E2E] enable sqlServer-cdc e2e testcase (#4708)
    
    Co-authored-by: zhilinli <[email protected]>
---
 .../connector/cdc/sqlserver/SqlServerCDCIT.java    | 28 +++++++++-------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-sqlserver-e2e/src/test/java/org/apache/seatunnel/e2e/connector/cdc/sqlserver/SqlServerCDCIT.java
 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-sqlserver-e2e/src/test/java/org/apache/seatunnel/e2e/connector/cdc/sqlserver/SqlServerCDCIT.java
index 2648c7a40..d1f0fd130 100644
--- 
a/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-sqlserver-e2e/src/test/java/org/apache/seatunnel/e2e/connector/cdc/sqlserver/SqlServerCDCIT.java
+++ 
b/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-sqlserver-e2e/src/test/java/org/apache/seatunnel/e2e/connector/cdc/sqlserver/SqlServerCDCIT.java
@@ -28,11 +28,11 @@ import org.awaitility.core.ConditionTimeoutException;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.BeforeAll;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.junit.jupiter.api.TestTemplate;
 import org.testcontainers.containers.MSSQLServerContainer;
 import org.testcontainers.containers.output.Slf4jLogConsumer;
 import org.testcontainers.lifecycle.Startables;
+import org.testcontainers.utility.DockerLoggerFactory;
 
 import com.google.common.collect.Lists;
 import lombok.extern.slf4j.Slf4j;
@@ -63,15 +63,13 @@ import static org.awaitility.Awaitility.await;
 @DisabledOnContainer(
         value = {},
         type = {EngineType.SPARK, EngineType.FLINK},
-        disabledReason = "")
+        disabledReason = "Currently SPARK and FLINK do not support cdc")
 public class SqlServerCDCIT extends TestSuiteBase implements TestResource {
 
     private static final String HOST = "sqlserver-host";
 
     private static final int PORT = 1433;
 
-    protected static final Logger LOG = 
LoggerFactory.getLogger(SqlServerCDCIT.class);
-
     private static final String STATEMENTS_PLACEHOLDER = "#";
 
     private static final Pattern COMMENT_PATTERN = 
Pattern.compile("^(.*)--.*$");
@@ -90,7 +88,9 @@ public class SqlServerCDCIT extends TestSuiteBase implements 
TestResource {
                     .withEnv("MSSQL_PID", "Standard")
                     .withNetwork(NETWORK)
                     .withNetworkAliases(HOST)
-                    .withLogConsumer(new Slf4jLogConsumer(LOG));
+                    .withLogConsumer(
+                            new Slf4jLogConsumer(
+                                    
DockerLoggerFactory.getLogger("sqlserver-docker-image")));
 
     @Override
     @BeforeAll
@@ -105,15 +105,14 @@ public class SqlServerCDCIT extends TestSuiteBase 
implements TestResource {
     @Override
     @AfterAll
     public void tearDown() throws Exception {
-        LOG.info("Stopping containers...");
+        log.info("Stopping containers...");
         if (MSSQL_SERVER_CONTAINER != null) {
             MSSQL_SERVER_CONTAINER.stop();
         }
-        LOG.info("Containers are stopped.");
+        log.info("Containers are stopped.");
     }
 
-    // Temporary disabled because the test can not be executed successfully
-    // https://github.com/apache/incubator-seatunnel/issues/3827
+    @TestTemplate
     public void test(TestContainer container) throws IOException, 
InterruptedException {
         initializeSqlServerTable("column_type_test");
 
@@ -140,11 +139,6 @@ public class SqlServerCDCIT extends TestSuiteBase 
implements TestResource {
         updateSourceTable();
 
         // stream stage
-        await().atMost(60000, TimeUnit.MILLISECONDS)
-                .untilAsserted(
-                        () -> {
-                            Assertions.assertEquals(4, 
querySql(SINK_SQL).size());
-                        });
         await().atMost(60000, TimeUnit.MILLISECONDS)
                 .untilAsserted(
                         () -> {
@@ -284,7 +278,7 @@ public class SqlServerCDCIT extends TestSuiteBase 
implements TestResource {
                                     connection.createStatement().execute(sql);
                                     return true;
                                 } catch (SQLException e) {
-                                    LOG.warn(
+                                    log.warn(
                                             String.format(
                                                     "DROP DATABASE %s failed 
(will be retried): {}",
                                                     databaseName),
@@ -297,7 +291,7 @@ public class SqlServerCDCIT extends TestSuiteBase 
implements TestResource {
                                                                 "ALTER 
DATABASE [%s] SET SINGLE_USER WITH ROLLBACK IMMEDIATE;",
                                                                 databaseName));
                                     } catch (SQLException e2) {
-                                        LOG.error("Failed to 
rollbackimmediately", e2);
+                                        log.error("Failed to 
rollbackimmediately", e2);
                                     }
                                     return false;
                                 }

Reply via email to