Skip to content

Commit

Permalink
[ci] Disable CDC before each test
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Feb 12, 2024
1 parent ef7ee32 commit 375286c
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 14 deletions.
8 changes: 7 additions & 1 deletion src/test/java/io/debezium/connector/db2/Db2ConnectorIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,15 @@ public class Db2ConnectorIT extends AbstractConnectorTest {

@Before
public void before() throws SQLException {
TestHelper.dropAllTables();
// CHECKSTYLE:OFF
System.out.println("failFlakyTests: " + System.getProperty(Flaky.FAIL_FLAKY_TESTS_PROPERTY));
// CHECKSTYLE:ON

connection = TestHelper.testConnection();

TestHelper.disableDbCdc(connection);
TestHelper.dropAllTables();

connection.execute("DELETE FROM ASNCDC.IBMSNAP_REGISTER");
connection.execute(
"CREATE TABLE tablea (id int not null, cola varchar(30), primary key (id))",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ public class Db2ReselectColumnsProcessorIT extends AbstractReselectProcessorTest
@Before
public void beforeEach() throws Exception {
connection = TestHelper.testConnection();

TestHelper.disableDbCdc(connection);
TestHelper.disableTableCdc(connection, "dbz4321");
connection.execute("DROP TABLE IF EXISTS dbz4321");

connection.execute("DELETE FROM ASNCDC.IBMSNAP_REGISTER");

initializeConnectorTestFramework();
Testing.Files.delete(TestHelper.DB_HISTORY_PATH);
super.beforeEach();
Expand Down
60 changes: 48 additions & 12 deletions src/test/java/io/debezium/connector/db2/IncrementalSnapshotIT.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,48 @@ public void before() throws SQLException {
@After
public void after() throws SQLException {
if (connection != null) {
TestHelper.disableDbCdc(connection);
TestHelper.disableTableCdc(connection, "A");
TestHelper.disableTableCdc(connection, "B");
TestHelper.disableTableCdc(connection, "DEBEZIUM_SIGNAL");
connection.rollback();
connection.execute(
"DROP TABLE IF EXISTS a",
"DROP TABLE IF EXISTS b",
"DROP TABLE IF EXISTS debezium_signal");
connection.execute("DELETE FROM ASNCDC.IBMSNAP_REGISTER");
connection.execute("DELETE FROM ASNCDC.IBMQREP_COLVERSION");
connection.execute("DELETE FROM ASNCDC.IBMQREP_TABVERSION");
try {
TestHelper.disableDbCdc(connection);
}
catch (Exception e) {
e.printStackTrace();
}
try {
TestHelper.disableTableCdc(connection, "A");
}
catch (Exception e) {
e.printStackTrace();
}
try {
TestHelper.disableTableCdc(connection, "B");
}
catch (Exception e) {
e.printStackTrace();
}
try {
TestHelper.disableTableCdc(connection, "DEBEZIUM_SIGNAL");
}
catch (Exception e) {
e.printStackTrace();
}
// connection.rollback();
try {
connection.execute(
"DROP TABLE IF EXISTS a",
"DROP TABLE IF EXISTS b",
"DROP TABLE IF EXISTS debezium_signal");
}
catch (Exception e) {
e.printStackTrace();
}
try {
connection.execute("DELETE FROM ASNCDC.IBMSNAP_REGISTER");
connection.execute("DELETE FROM ASNCDC.IBMQREP_COLVERSION");
connection.execute("DELETE FROM ASNCDC.IBMQREP_TABVERSION");
}
catch (Exception e) {
e.printStackTrace();
}
connection.close();
}
}
Expand Down Expand Up @@ -194,4 +224,10 @@ public void snapshotWithAdditionalConditionWithRestart() throws Exception {
super.snapshotWithAdditionalConditionWithRestart();
}

@Test
@Flaky("DBZ-7478")
public void snapshotWithAdditionalCondition() throws Exception {
super.snapshotWithAdditionalCondition();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static void enableDbCdc(Db2Connection connection) throws SQLException {
catch (InterruptedException e) {
}
}
if (count++ > 30) {
if (count++ > 60) {
throw new SQLException("ASNCAP server did not start.");
}
}
Expand Down

0 comments on commit 375286c

Please sign in to comment.