Kirk True created KAFKA-15557:
---------------------------------

             Summary: Fix duplicate metadata update in fetcher tests
                 Key: KAFKA-15557
                 URL: https://issues.apache.org/jira/browse/KAFKA-15557
             Project: Kafka
          Issue Type: Bug
          Components: clients
            Reporter: Kirk True
            Assignee: Kirk True


The unit tests {{FetcherTest}} and {{FetchRequestManagerTest}} have methods 
named {{assignFromUser()}} and {{assignFromUserNoId()}} that appear to perform 
duplicate metadata updates:

{code:java}
private void assignFromUser(Set<TopicPartition> partitions) {
    subscriptions.assignFromUser(partitions);
    client.updateMetadata(initialUpdateResponse);

    // A dummy metadata update to ensure valid leader epoch.
    metadata.updateWithCurrentRequestVersion(
            RequestTestUtils.metadataUpdateWithIds(
                "dummy",
                1, 
                Collections.emptyMap(),
                singletonMap(topicName, 4),
                tp -> validLeaderEpoch, topicIds
            ),
            false,
            0L
    );
}
{code}

{{client.updateMetadata()}} eventually calls 
{{metadata.updateWithCurrentRequestVersion()}}. Determine why the test is 
updating the cluster metadata twice with different values.



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

Reply via email to