Class ShareHeartbeatRequestManagerTest
java.lang.Object
org.apache.kafka.clients.consumer.internals.ShareHeartbeatRequestManagerTest
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetUp()voidvoidvoidTest that GROUP_ID_NOT_FOUND error while unsubscribed is not treated as fatal.voidTest that GROUP_ID_NOT_FOUND error while stable is treated as fatal.voidvoidvoidvoidvoidtestHeartbeatResponseOnErrorHandling(org.apache.kafka.common.protocol.Errors error, boolean isFatal) voidvoidvoidvoidShareConsumerImpl runs on the same ConsumerNetworkThread as the AsyncKafkaConsumer, thus we also test to ensure we don't enter a CPU spin state.voidWhile bootstrap DNS resolution is still in progress the coordinator is unknown, and a member that wants to join has a zero heartbeat interval, since the interval is only learned from the first heartbeat response.voidvoidvoidvoidThis is expected to be the case where a member is already leaving the group and the poll timer expires.voidtestSkippingHeartbeat(boolean shouldSkipHeartbeat) voidvoidvoidvoid
-
Constructor Details
-
ShareHeartbeatRequestManagerTest
public ShareHeartbeatRequestManagerTest()
-
-
Method Details
-
setUp
@BeforeEach public void setUp() -
testMaximumTimeToWaitWhenHeartbeatShouldBeSkippedDoesNotSpin
@Test public void testMaximumTimeToWaitWhenHeartbeatShouldBeSkippedDoesNotSpin()ShareConsumerImpl runs on the same ConsumerNetworkThread as the AsyncKafkaConsumer, thus we also test to ensure we don't enter a CPU spin state. Refer to KAFKA-20253 -
testMaximumTimeToWaitWhenFatalReturnsMaxValue
@Test public void testMaximumTimeToWaitWhenFatalReturnsMaxValue() -
testMaximumTimeToWaitWhenJoiningAndCoordinatorUnknownDoesNotSpin
@Test public void testMaximumTimeToWaitWhenJoiningAndCoordinatorUnknownDoesNotSpin()While bootstrap DNS resolution is still in progress the coordinator is unknown, and a member that wants to join has a zero heartbeat interval, since the interval is only learned from the first heartbeat response. maximumTimeToWait() must wait a retry backoff rather than the (zero) heartbeat interval; returning 0 busy-spins the application and network threads. -
testHeartbeatOnStartup
@Test public void testHeartbeatOnStartup() -
testFirstHeartbeatIncludesRequiredInfoToJoinGroupAndGetAssignments
@ParameterizedTest public void testFirstHeartbeatIncludesRequiredInfoToJoinGroupAndGetAssignments(short version) -
testSkippingHeartbeat
@ParameterizedTest @ValueSource(booleans={true,false}) public void testSkippingHeartbeat(boolean shouldSkipHeartbeat) -
testHeartbeatNotSentIfAnotherOneInFlight
@Test public void testHeartbeatNotSentIfAnotherOneInFlight() -
testNetworkTimeout
@Test public void testNetworkTimeout() -
testFailureOnFatalException
@Test public void testFailureOnFatalException() -
testUnsupportedVersionGeneratedOnTheBroker
@ParameterizedTest @ValueSource(strings="The cluster does not support the share group protocol. To use share groups, the cluster must have the share group protocol enabled.") public void testUnsupportedVersionGeneratedOnTheBroker(String errorMsg) -
testUnsupportedVersionGeneratedOnTheClient
@ParameterizedTest @ValueSource(strings="The cluster does not support the share group protocol using ShareGroupHeartbeat API version 1 or later. This version of the API was introduced in Apache Kafka v4.1.") public void testUnsupportedVersionGeneratedOnTheClient(String errorMsg) -
testHeartbeatState
@Test public void testHeartbeatState() -
testPollTimerExpiration
@Test public void testPollTimerExpiration() -
testHeartbeatMetrics
@Test public void testHeartbeatMetrics() -
testTimerNotDue
@Test public void testTimerNotDue() -
testHeartbeatOutsideInterval
@Test public void testHeartbeatOutsideInterval() -
testNoCoordinator
@Test public void testNoCoordinator() -
testPollTimerExpirationShouldNotMarkMemberStaleIfMemberAlreadyLeaving
@Test public void testPollTimerExpirationShouldNotMarkMemberStaleIfMemberAlreadyLeaving()This is expected to be the case where a member is already leaving the group and the poll timer expires. The poll timer expiration should not transition the member to STALE, and the member should continue to send heartbeats while the ongoing leaving operation completes (send heartbeats while waiting for callbacks before leaving, or send last heartbeat to leave). -
testSuccessfulHeartbeatTiming
@Test public void testSuccessfulHeartbeatTiming() -
testLogsHeartbeatIntervalReceivedFromCoordinatorOnlyWhenChanged
@Test public void testLogsHeartbeatIntervalReceivedFromCoordinatorOnlyWhenChanged() -
testGroupIdNotFoundExceptionWhileUnsubscribed
@Test public void testGroupIdNotFoundExceptionWhileUnsubscribed()Test that GROUP_ID_NOT_FOUND error while unsubscribed is not treated as fatal. This can happen when the consumer never successfully joined the group (e.g., due to an InvalidTopicException during poll() and close() sends a leave heartbeat for a group that was never created). -
testGroupIdNotFoundWhileStableIsFatal
@Test public void testGroupIdNotFoundWhileStableIsFatal()Test that GROUP_ID_NOT_FOUND error while stable is treated as fatal. This would indicate the group was unexpectedly deleted while the member was actively participating. -
testHeartbeatResponseOnErrorHandling
@ParameterizedTest @MethodSource("errorProvider") public void testHeartbeatResponseOnErrorHandling(org.apache.kafka.common.protocol.Errors error, boolean isFatal)
-