Fix flaky kafka test (#4272)

This commit is contained in:
Lauri Tulmin 2021-10-03 20:15:24 +03:00 committed by GitHub
parent 92394ad9ae
commit ce241d2bb3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 5 deletions

View File

@ -29,13 +29,13 @@ abstract class KafkaClientBaseTest extends InstrumentationSpecification {
protected static final SHARED_TOPIC = "shared.topic" protected static final SHARED_TOPIC = "shared.topic"
@Shared @Shared
static KafkaContainer kafka KafkaContainer kafka
@Shared @Shared
static Producer<Integer, String> producer Producer<Integer, String> producer
@Shared @Shared
static Consumer<Integer, String> consumer Consumer<Integer, String> consumer
@Shared @Shared
static CountDownLatch consumerReady = new CountDownLatch(1) CountDownLatch consumerReady = new CountDownLatch(1)
static TopicPartition topicPartition = new TopicPartition(SHARED_TOPIC, 0) static TopicPartition topicPartition = new TopicPartition(SHARED_TOPIC, 0)
@ -97,7 +97,7 @@ abstract class KafkaClientBaseTest extends InstrumentationSpecification {
} }
// Kafka's eventual consistency behavior forces us to do a couple of empty poll() calls until it gets properly assigned a topic partition // Kafka's eventual consistency behavior forces us to do a couple of empty poll() calls until it gets properly assigned a topic partition
static void awaitUntilConsumerIsReady() { void awaitUntilConsumerIsReady() {
if (consumerReady.await(0, TimeUnit.SECONDS)) { if (consumerReady.await(0, TimeUnit.SECONDS)) {
return return
} }