chia7712 commented on code in PR #23221:
URL: https://github.com/apache/kafka/pull/23221#discussion_r3855195196
##########
clients/src/test/java/org/apache/kafka/clients/consumer/internals/FetcherTest.java:
##########
@@ -299,11 +292,28 @@ public void testInflightFetchOnPendingPartitions() {
public void testCloseShouldBeIdempotent() {
buildFetcher();
- fetcher.close();
- fetcher.close();
- fetcher.close();
+ assignFromUser(singleton(tp0));
Review Comment:
This is good, but it's a little hard to follow. Another approach would be to
override closeInternal​with a counter, which can then be used to verify
idempotence
```java
fetcher = new Fetcher<>(
logContext,
consumerClient,
metadata,
subscriptionState,
fetchConfig,
new Deserializers<>(keyDeserializer, valueDeserializer,
metrics),
metricsManager,
time,
apiVersions) {
@Override
protected void closeInternal(Timer timer) {
++closeCount;
super.closeInternal(timer);
}
};
```
--
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]