Aleksandr Savonin created FLINK-39338:
-----------------------------------------
Summary: Fix topic collision in parameterized KafkaWriter tests
Key: FLINK-39338
URL: https://issues.apache.org/jira/browse/FLINK-39338
Project: Flink
Issue Type: Improvement
Components: Connectors / Kafka
Reporter: Aleksandr Savonin
{{KafkaWriterTestBase.setUp}} derives the Kafka topic name from
{{{}testInfo.getDisplayName(){}}}.
For parameterized tests using {{{}@EnumSource(DeliveryGuarantee.class){}}}, the
display name only contains the parameter index and value (e.g. {{{}[1]
EXACTLY_ONCE{}}}) without the method name.
This causes topic name collisions when multiple parameterized test methods use
the same enum source. For example, {{testRegisterMetrics}} and
{{testNotRegisterMetrics}} in {{KafkaWriterITCase}} both produce the same topic
name: {{{}1exactlyonce{}}}.
h3. Impact
Currently, this does not cause failures because {{createTopics}} is called in a
fire-and-forget manner (the future result is never awaited), so
{{TopicExistsException}} is silently swallowed.
However, this becomes a problem for [PR
#237|https://github.com/apache/flink-connector-kafka/pull/237] (FLINK-39234),
which replaces the topic creation with
{{{}createNewTopicAndWaitForPartitionAssignment{}}}, a utility that properly
awaits the result and fails on {{{}TopicExistsException{}}}. We discussed with
the author and we agreed I can speed the merge of the mentioned PR by improving
this topic name uniqueness in a separate PR.
h3. Solution
The fix adds the test method name to the topic name when it is not already part
of the display name, thus we ensure uniqueness across test methods.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)