Skip to content

Commit

Permalink
Fix flaky test for debezium (apache#5878)
Browse files Browse the repository at this point in the history
  • Loading branch information
tuteng authored and codelipenghui committed Dec 17, 2019
1 parent 9b55324 commit fe0ddcc
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2073,6 +2073,16 @@ private void testDebeziumMySqlConnect()

@Cleanup
PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(pulsarCluster.getHttpServiceUrl()).build();
try {
// If topic already exists, we should delete it so as not to affect the following tests.
admin.topics().getStats(consumeTopicName);
admin.topics().delete(consumeTopicName);
admin.schemas().deleteSchema(consumeTopicName);
} catch (PulsarAdminException e) {
// Expected results, ignoring the exception
log.info("Topic: {} does not exist, we can continue the following tests. Exceptions message: {}",
consumeTopicName, e.getMessage());
}
admin.topics().createNonPartitionedTopic(consumeTopicName);
admin.topics().createNonPartitionedTopic(outputTopicName);

Expand Down Expand Up @@ -2133,6 +2143,21 @@ private void testDebeziumPostgreSqlConnect() throws Exception {
.serviceUrl(pulsarCluster.getPlainTextServiceUrl())
.build();

@Cleanup
PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(pulsarCluster.getHttpServiceUrl()).build();
try {
// If topic already exists, we should delete it so as not to affect the following tests.
admin.topics().getStats(consumeTopicName);
admin.topics().delete(consumeTopicName);
admin.schemas().deleteSchema(consumeTopicName);
} catch (PulsarAdminException e) {
// Expected results, ignoring the exception
log.info("Topic: {} does not exist, we can continue the following tests. Exceptions message: {}",
consumeTopicName, e.getMessage());
}
admin.topics().createNonPartitionedTopic(consumeTopicName);
admin.topics().createNonPartitionedTopic(outputTopicName);

@Cleanup
Consumer<KeyValue<byte[], byte[]>> consumer = client.newConsumer(KeyValueSchema.kvBytes())
.topic(consumeTopicName)
Expand Down Expand Up @@ -2190,6 +2215,21 @@ private void testDebeziumMongoDbConnect() throws Exception {
.serviceUrl(pulsarCluster.getPlainTextServiceUrl())
.build();

@Cleanup
PulsarAdmin admin = PulsarAdmin.builder().serviceHttpUrl(pulsarCluster.getHttpServiceUrl()).build();
try {
// If topic already exists, we should delete it so as not to affect the following tests.
admin.topics().getStats(consumeTopicName);
admin.topics().delete(consumeTopicName);
admin.schemas().deleteSchema(consumeTopicName);
} catch (PulsarAdminException e) {
// Expected results, ignoring the exception
log.info("Topic: {} does not exist, we can continue the following tests. Exceptions message: {}",
consumeTopicName, e.getMessage());
}
admin.topics().createNonPartitionedTopic(consumeTopicName);
admin.topics().createNonPartitionedTopic(outputTopicName);

@Cleanup
Consumer<KeyValue<byte[], byte[]>> consumer = client.newConsumer(KeyValueSchema.kvBytes())
.topic(consumeTopicName)
Expand Down

0 comments on commit fe0ddcc

Please sign in to comment.