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


##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThreadTest.java:
##########
@@ -150,19 +209,19 @@ public void testStartupAndTearDown() throws 
InterruptedException {
     }
 
     @Test
-    public void testApplicationEvent() {
-        ApplicationEvent e = new PollEvent(100);
-        applicationEventsQueue.add(e);
+    void testRequestManagersArePolledOnce() {
         consumerNetworkThread.runOnce();
-        verify(applicationEventProcessor, times(1)).process(e);
+        requestManagers.entries().forEach(rmo -> rmo.ifPresent(rm -> 
verify(rm).poll(anyLong())));
+        requestManagers.entries().forEach(rmo -> rmo.ifPresent(rm -> 
verify(rm).maximumTimeToWait(anyLong())));
+        verify(networkClientDelegate).poll(anyLong(), anyLong());
     }
 
     @Test
-    public void testMetadataUpdateEvent() {
-        ApplicationEvent e = new NewTopicsMetadataUpdateRequestEvent();
+    public void testApplicationEvent() {

Review Comment:
   Not introduced by this PR, but reviewing this one I noticed that we have 
lots of similar tests for checking that runOnce processes the events (ex. 
testResetPositionsEventIsProcessed, testSyncCommitEvent, 
testAsyncCommitEvent...), all doing the same (add event, run once, check is 
processed). Could we parametrize this and have a single test maybe? (same shape 
as this one but receiving the event as param). Should allow us to remove lots 
that, in the end this component does not care about the specific events, it's 
just responsible for processing whatever event is added. 



-- 
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