OAK-11989 Fixed the nondeterminism of testTraceLoggingForBulkUpdates() caused by order-specific assertion #2588
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.
Problem
When the execution order is changed, the test function
testTraceLoggingForBulkUpdates()in MultiDocumentStoreTest.java shows a non-deterministic behavior, where the test sometimes fails with AssertionError.The root cause of this issue is that failedUpdates is returned as a set by SetUtils.difference. When it is converted to a string for logging in the TRACE log, the order of elements is non-deterministic. But the test expects a specific order
"failure for [" + modifiedRow + ", " + deletedRow + "]", resulting in a mismatch.Command to reproduce the output:
Proposed Fix
Instead of checking for an exact string match with a specific order, the test should check for the presence of the target strings in the log message, regardless of string order. The proposed fix splits the original assertion into small parts to check for the presence of different elements separately. With this fix, the non-deterministic behavior would be resolved.