[
https://issues.apache.org/jira/browse/FLINK-39338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rui Fan resolved FLINK-39338.
-----------------------------
Fix Version/s: kafka-5.0.0
Resolution: Fixed
Merged to main(5.0.0) via: bd2fd2b2c8a48b7d2a05387fc4fda61e878c902f
> 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
> Assignee: Aleksandr Savonin
> Priority: Minor
> Labels: pull-request-available
> Fix For: kafka-5.0.0
>
>
> {{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)