Fixing flaky test case in BulkDecompressor.java #1986
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.
Description
This Pull Request is meant to fix flakiness in the test BulkDecompressorTest.testDecompressUnknownCompressionFile()
The provided test is intermittently failing because it is doing a direct String comparison, in which the elements of a set are being printed in an error message. Since the order of the elements in a set is non-deterministic, the expected String is not matching the actual String. The following code is inducing the flakiness, where the
BulkDecomopressor.SUPPORTED_COMPRESSIONS
is aSet
of supported compression types.The described issue can be reproduced by running the test using the nondex plugin, with the following command -
mvn -pl v1 edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest="com.google.cloud.teleport.templates.BulkDecompressorTest"
which occasionally throws the error -
Fix
The provided fix changes the type of the SUPPORTED_COMPRESSIONS from
java.util.Set
tojava.util.List
. Since the set has been converted into a list, the ordering of the elements is deterministic, and hence the flakiness has been removed.I'd love to get feedback on this pull request. Please let me know if you'd like to see any changes!