aljoscha commented on a change in pull request #12255:
URL: https://github.com/apache/flink/pull/12255#discussion_r427454437



##########
File path: 
flink-connectors/flink-connector-kafka-0.10/src/test/java/org/apache/flink/streaming/connectors/kafka/KafkaTestEnvironmentImpl.java
##########
@@ -322,32 +324,25 @@ public void createTestTopic(String topic, int 
numberOfPartitions, int replicatio
 
                // validate that the topic has been created
                final long deadline = System.nanoTime() + 30_000_000_000L;
-               do {
-                       try {
-                               if (config.isSecureMode()) {
-                                       //increase wait time since in Travis ZK 
timeout occurs frequently
-                                       int wait = zkTimeout / 100;
-                                       LOG.info("waiting for {} msecs before 
the topic {} can be checked", wait, topic);
-                                       Thread.sleep(wait);
-                               } else {
-                                       Thread.sleep(100);
+               boolean topicCreated = false;
+               Properties props = new Properties();
+               props.setProperty(ConsumerConfig.BOOTSTRAP_SERVERS_CONFIG, 
getBrokerConnectionString());
+               props.setProperty(ConsumerConfig.KEY_DESERIALIZER_CLASS_CONFIG, 
ByteArrayDeserializer.class.getName());
+               
props.setProperty(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, 
ByteArrayDeserializer.class.getName());
+               props.putAll(getSecureProperties());
+               try (KafkaConsumer<byte[], byte[]> consumer = new 
KafkaConsumer<>(props)) {
+                       do {
+                               topicCreated = 
!consumer.partitionsFor(topic).isEmpty();
+                               if (!topicCreated) {
+                                       Thread.sleep(1);

Review comment:
       Maybe 1ms sleep is a bit to agressive. 10 or even 100 should work as well




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to