Fix nondeterministic behavior in Protobuf and Quartz-related tests#18690
Merged
kfaraz merged 4 commits intoapache:masterfrom Oct 27, 2025
Merged
Conversation
added 3 commits
October 22, 2025 22:56
… [6,7] and [7,6] orderings in error message
…FileBasedProtobufBytesDecoderTest
…fix-nondeterminism-protobuf-and-quartz
kfaraz
reviewed
Oct 24, 2025
Contributor
kfaraz
left a comment
There was a problem hiding this comment.
Thanks for the PR, @Shiyang-Zhao .
I have left a minor suggestion.
| @@ -132,7 +133,11 @@ public void testSingleDescriptorNoMessageType() | |||
| { | |||
| final var decoder = new FileBasedProtobufBytesDecoder("proto_test_event.desc", null); | |||
|
|
|||
| assertEquals("google.protobuf.Timestamp", decoder.getDescriptor().getFullName()); | |||
| String actual = decoder.getDescriptor().getFullName(); | |||
Contributor
There was a problem hiding this comment.
Please add a short comment on the source of the flakiness/difference.
| @@ -111,8 +112,13 @@ public void testInvalidCronExpression() | |||
| DruidException.class, | |||
| () -> new QuartzCronSchedulerConfig("0 15 10 * *") | |||
| ), | |||
| DruidExceptionMatcher.invalidInput().expectMessageIs( | |||
| "Quartz schedule[0 15 10 * *] is invalid: [Cron expression contains 5 parts but we expect one of [6, 7]]" | |||
| Matchers.anyOf( | |||
Contributor
There was a problem hiding this comment.
Please add a one-line comment on the source of the flakiness.
Contributor
Author
|
@kfaraz |
kfaraz
approved these changes
Oct 24, 2025
Contributor
kfaraz
left a comment
There was a problem hiding this comment.
Thanks for the fix, @Shiyang-Zhao !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes nondeterministic behavior in the following flaky tests:
org.apache.druid.data.input.protobuf.InlineDescriptorProtobufBytesDecoderTest.testSingleDescriptorNoMessageTypeorg.apache.druid.data.input.protobuf.FileBasedProtobufBytesDecoderTest.testSingleDescriptorNoMessageTypeorg.apache.druid.indexing.scheduledbatch.QuartzCronSchedulerConfigTest.testInvalidCronExpressionDescription
The tests
InlineDescriptorProtobufBytesDecoderTest.testSingleDescriptorNoMessageTypeandFileBasedProtobufBytesDecoderTest.testSingleDescriptorNoMessageTypefailed intermittently because Protobuf does not guarantee a consistent order when iterating over message descriptors.Depending on internal ordering, the decoder could return either
google.protobuf.Timestamporprototest.ProtoTestEvent. The tests originally asserted equality against a single expected name, causing nondeterministic failures even though both outcomes were correct.Failure messages:
Proposed Changes:
The
QuartzCronSchedulerConfigTest.testInvalidCronExpressionfailed due to nondeterministic ordering in Quartz’s validation error messages.When validating malformed cron expressions, Quartz reports multiple expected-part counts (e.g.,
[6, 7]vs[7, 6]), and the order of these values is not stable. The previous test compared messages strictly by string equality, leading to flaky results when the order changed.Failure messages:
Proposed Changes:
This PR has: