You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Hung-Yau Su (Jira)" <ji...@apache.org> on 2026/09/17 19:25:00 UTC

[jira] [Assigned] (KAFKA-21121) shouldBeEqualsIfOnlyDifferInCommittedOffsets and shouldBeEqualsIfOnlyDifferInEndOffsets don't test what they want

     [ https://issues.apache.org/jira/browse/KAFKA-21121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hung-Yau Su reassigned KAFKA-21121:
-----------------------------------

    Assignee: Hung-Yau Su  (was: Chia-Ping Tsai)

> shouldBeEqualsIfOnlyDifferInCommittedOffsets and shouldBeEqualsIfOnlyDifferInEndOffsets don't test what they want
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-21121
>                 URL: https://issues.apache.org/jira/browse/KAFKA-21121
>             Project: Kafka
>          Issue Type: Test
>            Reporter: Chia-Ping Tsai
>            Assignee: Hung-Yau Su
>            Priority: Trivial
>
> {code:java}
>     public static final Map<TopicPartition, Long> COMMITTED_OFFSETS = mkMap(mkEntry(TP_1, 1L), mkEntry(TP_1, 2L));
>     public static final Map<TopicPartition, Long> END_OFFSETS = mkMap(mkEntry(TP_1, 1L), mkEntry(TP_1, 3L)); {code}
> COMMITTED_OFFSETS and END_OFFSETS should have two items, but they use {{TP_1}} for both keys. shouldBeEqualsIfOnlyDifferInCommittedOffsets and shouldBeEqualsIfOnlyDifferInEndOffsets have the same typo. As a result, the committed offsets in shouldBeEqualsIfOnlyDifferInCommittedOffsets end up identical to COMMITTED_OFFSETS, which violates the test scenario. shouldBeEqualsIfOnlyDifferInEndOffsets still passes with different values, but only by luck.
> BTW, we should leverage Map.of to avoid similar typo in the future 😊



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