Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

When maxWait is reached, consume return messages received so far #1

Closed
wants to merge 2 commits into from

Conversation

bittrance
Copy link
Owner

The previous behavior, to panic on deadline is problematic, since there are a number of scenarios where you simply do not know how many messages there are to consume or when they are produced. For example, a load test may produce messages in bursts with jitter for a burn-in test, to try to provoke i data races in the test subject.

The commit also adds a test to verify that we panic if Close() is called while we are consuming. Given the nature of the problem xk6-kafka is trying to solve, this sounds like an errar condition.

reader := test.module.Kafka.reader(&ReaderConfig{
Brokers: []string{"localhost:9092"},
Topic: test.topicName,
MaxWait: Duration{250 * time.Millisecond},
Copy link
Owner Author

Choose a reason for hiding this comment

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

We do not need 3 seconds to get down to the consume() call even on noisy Github :)

* Each test that uses a topic now creates its own.

Topic names use test name and unix time, so it is easy to
find and inspect it when the test fails. This also removes
some offsets that worked around other tests having polluted
the common topic.

* Do not depend on values being shared between assert closures.
Copy link

@mostafa mostafa left a comment

Choose a reason for hiding this comment

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

LGTM!

The current behavior, to panic on deadline is problematic, since
there are a number of scenarios where you simply do not know how
many messages there are to consume or when they are produced. For
example, a load test may produce messages in bursts with jitter
for a burn-in test, to try to provoke i data races in the test
subject.

This commit introduces a flag ExpectTimeout which will return message
received so far.

The commit also adds a test to verify that we panic if Close() is
called while we are consuming. Given the nature of the problem
xk6-kafka is trying to solve, this sounds like an errar condition.
@bittrance bittrance force-pushed the consume-returns-on-deadline branch from e413d37 to 7b8efa7 Compare December 3, 2024 19:00
@bittrance
Copy link
Owner Author

Now on upstream as mostafa#313.

@bittrance bittrance closed this Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants