diff --git a/clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java b/clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java index bff8f970d6da..b2420f29bda0 100644 --- a/clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java +++ b/clients/src/test/java/org/apache/kafka/clients/consumer/KafkaConsumerTest.java @@ -924,16 +924,14 @@ public void testMissingOffsetNoResetPolicy(GroupProtocol groupProtocol) throws I initMetadata(client, Collections.singletonMap(topic, 1)); Node node = metadata.fetch().nodes().get(0); - consumer = newConsumer(groupProtocol, time, client, subscription, metadata, assignor, - true, groupId, groupInstanceId, false); - consumer.assign(singletonList(tp0)); - client.prepareResponseFrom(FindCoordinatorResponse.prepareResponse(Errors.NONE, groupId, node), node); Node coordinator = new Node(Integer.MAX_VALUE - node.id(), node.host(), node.port()); - - // lookup committed offset and find nothing client.prepareResponseFrom(offsetResponse(Collections.singletonMap(tp0, -1L), Errors.NONE), coordinator); + consumer = newConsumer(groupProtocol, time, client, subscription, metadata, assignor, + true, groupId, groupInstanceId, false); + consumer.assign(singletonList(tp0)); + if (groupProtocol == GroupProtocol.CONSUMER) { // New consumer poll(ZERO) needs to wait for the offset fetch event added by a call to poll, to be processed // by the background thread, so it can realize there are no committed offsets and then