PoAn Yang created KAFKA-17129:
---------------------------------

             Summary: Revisit FindCoordinatorResponse in KafkaConsumerTest
                 Key: KAFKA-17129
                 URL: https://issues.apache.org/jira/browse/KAFKA-17129
             Project: Kafka
          Issue Type: Sub-task
            Reporter: PoAn Yang
            Assignee: PoAn Yang


Currently, we have many test cases put 
`client.prepareResponseFrom(FindCoordinatorResponse.prepareResponse(...), 
...);` after `newConsumer`. If `FutureResponse` is not in `MockClient`, the 
request can't get a response. This may cause some flaky tests.
 
In our KafkaConsumerTest design, when starting a `newConsumer` for 
`AsyncKafkaConsumer`, it always sends `FindCoordinatorRequest`.
 
In `MockClient#send`, if a `FutureResponse` is missing, the request will be add 
to `requests`. Even if `client.prepareResponseFrom` adds a new 
`FutureResponse`, it can't be matched to an existent request, so the request 
can't get a response.
 
It's better to put 
`client.prepareResponseFrom(FindCoordinatorResponse.prepareResponse(...), 
...);` before `newConsumer`, so we don't miss any `FindCoordinatorRequest`.



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

Reply via email to