lianetm commented on code in PR #16200:
URL: https://github.com/apache/kafka/pull/16200#discussion_r1668910020


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManagerTest.java:
##########
@@ -357,31 +420,62 @@ public void testNoCoordinator() {
     @ParameterizedTest
     @ApiKeyVersionsSource(apiKey = ApiKeys.CONSUMER_GROUP_HEARTBEAT)
     public void testValidateConsumerGroupHeartbeatRequest(final short version) 
{
+        membershipManager = new MembershipManagerImpl(
+                DEFAULT_GROUP_ID,
+                Optional.of(DEFAULT_GROUP_INSTANCE_ID),
+                0,
+                Optional.of("uniform"),
+                subscriptions,
+                mock(CommitRequestManager.class),
+                (ConsumerMetadata) metadata,
+                logContext,
+                Optional.of(mock(ClientTelemetryReporter.class)),
+                backgroundEventHandler,
+                time,
+                new Metrics()
+        );
+        membershipManager.transitionToJoining();
+
+        heartbeatState = new HeartbeatState(
+                subscriptions,
+                membershipManager,
+                DEFAULT_MAX_POLL_INTERVAL_MS
+        );
+
+        heartbeatRequestManager = createHeartbeatRequestManager(
+                coordinatorRequestManager,
+                membershipManager,
+                heartbeatState,
+                heartbeatRequestState,
+                backgroundEventHandler
+        );
+
         // The initial heartbeatInterval is set to 0, but we're testing
-        resetWithZeroHeartbeatInterval(Optional.of(DEFAULT_GROUP_INSTANCE_ID));
-        mockStableMember();
+        time.sleep(DEFAULT_HEARTBEAT_INTERVAL_MS);
 
         List<String> subscribedTopics = Collections.singletonList("topic");
-        subscriptions.subscribe(new HashSet<>(subscribedTopics), 
Optional.empty());
+        
when(subscriptions.subscription()).thenReturn(Collections.singleton("topic"));

Review Comment:
   should we reference the same `subscribedTopics` var in the `thenReturn` as 
before? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to