use of io.confluent.ksql.test.util.ThreadTestUtil.ThreadSnapshot in project ksql by confluentinc.
the class RestQueryTranslationTest method tearDown.
@After
public void tearDown() {
REST_APP.closePersistentQueries();
REST_APP.dropSourcesExcept();
// Sometimes a race-condition throws an error when deleting a changelog topic (created by
// a CST query) that is later deleted automatically just before the Kafka API delete is called.
// Let's retry a few more times before marking this deletion as failure.
RetryUtil.retryWithBackoff(10, 10, (int) TimeUnit.SECONDS.toMillis(10), () -> TEST_HARNESS.getKafkaCluster().deleteAllTopics(TestKsqlRestApp.getCommandTopicName()));
final ThreadSnapshot thread = STARTING_THREADS.get();
if (thread == null) {
// Only set once one full run completed to ensure all persistent threads created:
STARTING_THREADS.set(ThreadTestUtil.threadSnapshot(filterBuilder().excludeTerminated().nameMatches(name -> !name.startsWith("ksql-workers")).nameMatches(name -> !name.startsWith("pull-query-coordinator")).nameMatches(name -> !name.startsWith("pull-query-router")).build()));
} else {
thread.assertSameThreads();
}
}
Aggregations