Class StreamsGroupTopologyDescriptionRequestManagerTest
java.lang.Object
org.apache.kafka.clients.consumer.internals.StreamsGroupTopologyDescriptionRequestManagerTest
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetUp()voidTest the situation when the broker responds with NOT_COORDINATOR or COORDINATOR_NOT_AVAILABLE: coordinator rediscovery should be triggered and the flag should remain set for retry.voidTest the situation when the broker responds with COORDINATOR_LOAD_IN_PROGRESS: the flag should remain set for retry but coordinator rediscovery should not be triggered, since the coordinator is correct but still loading.voidTest the situation when the coordinator has not yet been discovered: no request should be sent and the client should silently wait for the coordinator to become known.voidTest the situation when the broker responds with no error: the topologyPushRequired flag should be cleared so the manager stops pushing.voidTest the situation when the broker responds with UNKNOWN_MEMBER_ID: the flag should be cleared so the heartbeat path can drive a clean rejoin.voidTest the situation when memberId is null because the member has not yet joined the group: no request should be sent.voidTest the situation when the push fails with a network exception: the topologyPushRequired flag must remain set so the next poll retries, and a failed attempt is recorded so retry backoff applies.voidTest the situation when a push request is already in flight: subsequent polls should not enqueue duplicate requests.voidTest the situation when all preconditions are satisfied: maximumTimeToWait should return 0 to wake the poll loop immediately, and the subsequent poll should build a request with the correct groupId, memberId, and target coordinator node.voidTest the situation when the broker responds with a terminal error listed in KIP-1331: the flag should be cleared and the client should not retry on its own.voidTest the situation when the response carries a non-zero ThrottleTimeMs: subsequent push attempts should be delayed by that amount before resuming.voidTest the situation when the topologyPushRequired flag is not set: maximumTimeToWait should return Long.MAX_VALUE and no request should be sent even if every other precondition is satisfied.voidTest the situation when the wire-format topology description has not yet been populated: no request should be sent.
-
Constructor Details
-
StreamsGroupTopologyDescriptionRequestManagerTest
public StreamsGroupTopologyDescriptionRequestManagerTest()
-
-
Method Details
-
setUp
@BeforeEach public void setUp() -
testCoordinatorUnknown
@Test public void testCoordinatorUnknown()Test the situation when the coordinator has not yet been discovered: no request should be sent and the client should silently wait for the coordinator to become known. -
testWireTopologyDescriptionNull
@Test public void testWireTopologyDescriptionNull()Test the situation when the wire-format topology description has not yet been populated: no request should be sent. -
testMemberIdNull
@Test public void testMemberIdNull()Test the situation when memberId is null because the member has not yet joined the group: no request should be sent. -
testTopologyDescriptionWhenPushFlagNotSet
@Test public void testTopologyDescriptionWhenPushFlagNotSet()Test the situation when the topologyPushRequired flag is not set: maximumTimeToWait should return Long.MAX_VALUE and no request should be sent even if every other precondition is satisfied. -
testSendRequestWhenAllPreconditionsMet
@Test public void testSendRequestWhenAllPreconditionsMet()Test the situation when all preconditions are satisfied: maximumTimeToWait should return 0 to wake the poll loop immediately, and the subsequent poll should build a request with the correct groupId, memberId, and target coordinator node. -
testNoSecondRequestWhileInflight
@Test public void testNoSecondRequestWhileInflight()Test the situation when a push request is already in flight: subsequent polls should not enqueue duplicate requests. -
testFlagClearedOnSuccess
@Test public void testFlagClearedOnSuccess()Test the situation when the broker responds with no error: the topologyPushRequired flag should be cleared so the manager stops pushing. -
testFlagClearedOnUnknownMemberId
@Test public void testFlagClearedOnUnknownMemberId()Test the situation when the broker responds with UNKNOWN_MEMBER_ID: the flag should be cleared so the heartbeat path can drive a clean rejoin. -
testCoordinatorErrorTriggersRediscovery
@Test public void testCoordinatorErrorTriggersRediscovery()Test the situation when the broker responds with NOT_COORDINATOR or COORDINATOR_NOT_AVAILABLE: coordinator rediscovery should be triggered and the flag should remain set for retry. -
testCoordinatorLoadInProgressDoesNotTriggerRediscovery
@Test public void testCoordinatorLoadInProgressDoesNotTriggerRediscovery()Test the situation when the broker responds with COORDINATOR_LOAD_IN_PROGRESS: the flag should remain set for retry but coordinator rediscovery should not be triggered, since the coordinator is correct but still loading. -
testTerminalErrorsClearFlag
@Test public void testTerminalErrorsClearFlag()Test the situation when the broker responds with a terminal error listed in KIP-1331: the flag should be cleared and the client should not retry on its own. -
testNetworkExceptionLeavesFlagSetWithBackoff
@Test public void testNetworkExceptionLeavesFlagSetWithBackoff()Test the situation when the push fails with a network exception: the topologyPushRequired flag must remain set so the next poll retries, and a failed attempt is recorded so retry backoff applies. -
testThrottleDelayBlocksSubsequentRequest
@Test public void testThrottleDelayBlocksSubsequentRequest()Test the situation when the response carries a non-zero ThrottleTimeMs: subsequent push attempts should be delayed by that amount before resuming.
-