lianetm commented on code in PR #16140:
URL: https://github.com/apache/kafka/pull/16140#discussion_r1625068181
##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/ConsumerNetworkThreadTest.java:
##########
@@ -270,30 +326,27 @@ void testPollResultTimer() {
void testMaximumTimeToWait() {
// Initial value before runOnce has been called
assertEquals(ConsumerNetworkThread.MAX_POLL_TIMEOUT_MS,
consumerNetworkThread.maximumTimeToWait());
+
+
when(requestManagers.entries()).thenReturn(Collections.singletonList(Optional.of(heartbeatRequestManager)));
+
when(heartbeatRequestManager.maximumTimeToWait(time.milliseconds())).thenReturn((long)
DEFAULT_HEARTBEAT_INTERVAL_MS);
+
consumerNetworkThread.runOnce();
// After runOnce has been called, it takes the default heartbeat
interval from the heartbeat request manager
assertEquals(DEFAULT_HEARTBEAT_INTERVAL_MS,
consumerNetworkThread.maximumTimeToWait());
}
@Test
- void testRequestManagersArePolledOnce() {
- consumerNetworkThread.runOnce();
- testBuilder.requestManagers.entries().forEach(rmo -> rmo.ifPresent(rm
-> verify(rm, times(1)).poll(anyLong())));
- testBuilder.requestManagers.entries().forEach(rmo -> rmo.ifPresent(rm
-> verify(rm, times(1)).maximumTimeToWait(anyLong())));
- verify(networkClient, times(1)).poll(anyLong(), anyLong());
- }
+ void testEnsureEventsAreCompleted() {
Review Comment:
Not introduced by this PR but since we're improving here, I find that this
test does not bring any value, because it's testing something that it's not the
responsibility of the `ConsumerNetworkThread`, so we end up testing something
we're mocking ourselves with the `doAnswer`. What do you think?
I had suggested to remove it completely. See my original comment about it on
this other [PR](https://github.com/apache/kafka/pull/15640/files#r1608897877).
If you agree I would say we remove it instead of keep having to maintain it.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]