-
Notifications
You must be signed in to change notification settings - Fork 14k
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
KAFKA-17990: Flaky test improvements #17814
base: trunk
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, seems good to me. I will wait for the test and might try to run couple of times to see the flakiness behaviour.
@@ -322,6 +325,7 @@ public void testAcknowledgementCommitCallbackSuccessfulAcknowledgement(String pe | |||
ProducerRecord<byte[], byte[]> record = new ProducerRecord<>(tp.topic(), tp.partition(), null, "key".getBytes(), "value".getBytes()); | |||
KafkaProducer<byte[], byte[]> producer = createProducer(new ByteArraySerializer(), new ByteArraySerializer()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should the closeable resources be closed in a try / finally block so that the resources are closed even if we have an assertion failure?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that's probably a good thing to do. I'll put in the next commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, with the exception of the tests which use ExecutorService. I'll see if I can improve those too.
We recently changed the default starting position for consumption from earliest to latest to match the KIP, which necessitated alter configs for the tests to "earliest". The point at which this takes effect is non-deterministic and I believe that's responsible for the increased flakiness. |
shareConsumer.close(); | ||
producer.close(); | ||
try (KafkaProducer<byte[], byte[]> producer = createProducer(new ByteArraySerializer(), new ByteArraySerializer()); | ||
KafkaShareConsumer<byte[], byte[]> shareConsumer = createShareConsumer(new ByteArrayDeserializer(), new ByteArrayDeserializer(), "group1")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to close shareConsumer here and other places ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happens automatically because these resources are opened in a try-with-resource block. As the scope of the try block is exited, the resources are automatically closed.
Several of the
ShareConsumerTest
integration tests are a bit flaky. This PR tightens up the logic with the aim of eliminating the flakes. Annoyingly the tests seem rock solid locally so this might take some experimentation.Committer Checklist (excluded from commit message)