You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "brenden20 (via GitHub)" <gi...@apache.org> on 2024/07/22 15:30:13 UTC
Re: [PR] KAFKA-16558: Implemented HeartbeatRequestState toStringBase() and added a test for it [kafka]
brenden20 commented on code in PR #16373:
URL: https://github.com/apache/kafka/pull/16373#discussion_r1686746058
##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/HeartbeatRequestManagerTest.java:
##########
@@ -153,6 +154,35 @@ public void cleanup() {
}
}
+ @Test
+ public void testHeartBeatRequestStateToStringBase() {
+ long retryBackoffMs = 100;
+ long retryBackoffMaxMs = 1000;
+ LogContext logContext = new LogContext();
+ HeartbeatRequestState heartbeatRequestState = new HeartbeatRequestState(
+ logContext,
+ time,
+ DEFAULT_HEARTBEAT_INTERVAL_MS,
+ retryBackoffMs,
+ retryBackoffMaxMs,
+ .2
+ );
+
+ RequestState requestState = new RequestState(
+ logContext,
+ HeartbeatRequestManager.HeartbeatRequestState.class.getName(),
+ retryBackoffMs,
+ retryBackoffMaxMs
+ );
+
+ String target = requestState.toStringBase() +
+ ", remainingMs=" + heartbeatRequestState.heartbeatTimer().remainingMs() +
Review Comment:
I see your point, I have updated the test now. Since we compute `target` right after creating a `RequestState`, I thought for the test it would be appropriate to hard-code `remainingMs` to be equal to `DEFAULT_HEARTBEAT_INTERVAL_MS`. I have also removed the `heartbeatTimer()` method.
--
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-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org