DBZ-4475 Fix randomly failing updatePrimaryKeyTwiceWithRestartInMiddleOfTx
Fix randomly failing SqlServerConnectorIT#updatePrimaryKeyTwiceWithRestartInMiddleOfTx Wait for snapshot to be complteted and consume expected number of records.
This commit is contained in:
parent
f6264fb8ca
commit
63167469c2
@ -639,7 +639,9 @@ public void updatePrimaryKeyTwiceWithRestartInMiddleOfTx() throws Exception {
|
||||
});
|
||||
assertConnectorIsRunning();
|
||||
|
||||
consumeRecordsByTopic(1);
|
||||
TestHelper.waitForDatabaseSnapshotToBeCompleted(TestHelper.TEST_DATABASE_1);
|
||||
final SourceRecords snapshotRecords = consumeRecordsByTopic(1);
|
||||
Assertions.assertThat(snapshotRecords.allRecordsInOrder()).hasSize(1);
|
||||
|
||||
connection.setAutoCommit(false);
|
||||
|
||||
@ -659,12 +661,14 @@ public void updatePrimaryKeyTwiceWithRestartInMiddleOfTx() throws Exception {
|
||||
|
||||
start(SqlServerConnector.class, config);
|
||||
assertConnectorIsRunning();
|
||||
final SourceRecords records2 = consumeRecordsByTopic(6);
|
||||
|
||||
final int expectedRecords = 20;
|
||||
final SourceRecords records2 = consumeRecordsByTopic(expectedRecords - records1.allRecordsInOrder().size());
|
||||
|
||||
final List<SourceRecord> tableB = records1.recordsForTopic("server1.testDB1.dbo.tableb");
|
||||
tableB.addAll(records2.recordsForTopic("server1.testDB1.dbo.tableb"));
|
||||
|
||||
Assertions.assertThat(tableB).hasSize(20);
|
||||
Assertions.assertThat(tableB).hasSize(expectedRecords);
|
||||
|
||||
stopConnector();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user