Divij Vaidya created KAFKA-15140:
------------------------------------

             Summary: Improve TopicCommandIntegrationTest to be less flaky
                 Key: KAFKA-15140
                 URL: https://issues.apache.org/jira/browse/KAFKA-15140
             Project: Kafka
          Issue Type: Test
          Components: unit tests
            Reporter: Divij Vaidya


*This is a good Jira for folks who are new to contributing to Kafka.*

Tests in TopicCommandIntegrationTest get flaky from time to time. The objective 
of the task is to make them more robust by doing the following:

1. Replace the usage createAndWaitTopic() method and other places where were 
are creating a topic (without waiting) with 
TestUtils.createTopicWithAdmin(). The latter method already contains the 
functionality to create a topic and wait for metadata to sync up.

2. Replace the number 6 at places such as 
"adminClient.createTopics(
Collections.singletonList(new NewTopic("foo_bar", 1, 6.toShort)))" with a 
meaningful constant.

3. Add logs if an assertion fails, for example, lines such as "
assertTrue(rows(0).startsWith(s"\tTopic: $testTopicName"), output)" should have 
a third argument which prints the actual output printed so that we can observe 
in the test logs on what was the output when assertion failed.

4. Replace occurrences of "\n" with System.lineSeparator() which is platform 
independent

5. We should wait for reassignment to complete whenever we are re-assigning 
partitions using alterconfig before we call describe to validate it. We could 
use 
TestUtils.waitForAllReassignmentsToComplete()



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to