Description
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`.
Attachments
Issue Links
- links to