JingsongLi commented on a change in pull request #18326:
URL: https://github.com/apache/flink/pull/18326#discussion_r781978821
##########
File path:
flink-end-to-end-tests/flink-end-to-end-tests-common-kafka/src/main/java/org/apache/flink/tests/util/kafka/KafkaContainerClient.java
##########
@@ -99,7 +102,19 @@ public void createTopic(int replicationFactor, int
numPartitions, String topic)
final List<T> messages = Collections.synchronizedList(new
ArrayList<>(expectedNumMessages));
try (Consumer<Bytes, T> consumer =
new KafkaConsumer<>(props, new BytesDeserializer(),
valueDeserializer)) {
- consumer.subscribe(Pattern.compile(topic));
+ // Wait until the reading topic is created
+ CommonTestUtils.waitUtil(
+ () ->
consumer.listTopics(Duration.ofSeconds(1)).containsKey(topic),
+ Duration.ofSeconds(30),
Review comment:
Longer? maybe 60s?
##########
File path:
flink-end-to-end-tests/flink-end-to-end-tests-common-kafka/src/main/java/org/apache/flink/tests/util/kafka/KafkaContainerClient.java
##########
@@ -99,7 +102,19 @@ public void createTopic(int replicationFactor, int
numPartitions, String topic)
final List<T> messages = Collections.synchronizedList(new
ArrayList<>(expectedNumMessages));
try (Consumer<Bytes, T> consumer =
new KafkaConsumer<>(props, new BytesDeserializer(),
valueDeserializer)) {
- consumer.subscribe(Pattern.compile(topic));
+ // Wait until the reading topic is created
+ CommonTestUtils.waitUtil(
Review comment:
Can we extract a method: 'waitTopicCreation'?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]