Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[fix][test] Fix SimpleProducerConsumerTest.testMultiTopicsConsumerImplPauseForManualSubscription #23531

Conversation

ZhaoGuorui666
Copy link
Contributor

@ZhaoGuorui666 ZhaoGuorui666 commented Oct 30, 2024

Fixes #23485

Motivation

Awaitility.await().untilAsserted(() -> assertNull(consumer.receive(RECEIVE_TIMEOUT_SECONDS, TimeUnit.SECONDS)));
The problem lies in this line of code. Through the logs, it can be seen that the exception situation is two calls to consumer. receive. The first call obtains null, and after the successful assertion returns, the second call will receive a message, resulting in one less total call.

image

企业微信截图_17302904118685

Modifications

Change assertion related code

Verifying this change

企业微信截图_17302951303412

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Oct 30, 2024
@ZhaoGuorui666 ZhaoGuorui666 changed the title solve issue#23485 [fix][test] Fix SimpleProducerConsumerTest.testMultiTopicsConsumerImplPauseForManualSubscription Oct 30, 2024
@@ -3557,7 +3557,8 @@ public void testMultiTopicsConsumerImplPauseForManualSubscription() throws Excep
}

// 6. should not consume any messages
Awaitility.await().untilAsserted(() -> assertNull(consumer.receive(RECEIVE_TIMEOUT_SECONDS, TimeUnit.SECONDS)));
Message<byte[]> msg = consumer.receive(2, TimeUnit.SECONDS);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's already several constants for timeouts. Perhaps receive(RECEIVE_TIMEOUT_MEDIUM_MILLIS, TimeUnit.MILLISECONDS) could be used instead.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
doc-not-needed Your PR changes do not impact docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky-test: SimpleProducerConsumerTest.testMultiTopicsConsumerImplPauseForManualSubscription
2 participants