Skip to content

Fixed All Flaky Tests #1

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

Merged
merged 9 commits into from
Feb 7, 2022
Merged

Fixed All Flaky Tests #1

merged 9 commits into from
Feb 7, 2022

Conversation

kaiyaok2
Copy link
Owner

@kaiyaok2 kaiyaok2 commented Jan 15, 2022

Description
2 flaky tests are found using Nondex when running commands
mvn edu.illinois:nondex-maven-plugin:1.1.2:nondex Dtest=DynamoDBEncryptorTest#ensureEncryptedAttributesUnmodified
and
mvn edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=AttributeValueMarshallerTest#testSimpleMapWithNull
The reason for test flakiness is that Java map API does not preserve the order of the key-value pairs. Comparing maps by casting to string can fail when, for example, the Java version upgrades in the future, or when the code is run in different environment.

Flaky Tests and Fixes

  • Test:ensureEncryptedAttributesUnmodified in DynamoDBEncryptor.java.
    Reason & Fix: The test tries to compare two maps after casting them to strings. However, item orders in maps are not preserved. I converted the referenced maps to TreeMaps before casting them to string.

  • Test:testSimpleMapWithNull in AttributeValueMarshallerTest.java
    Reason & Fix: Part of the expected string is a representation of a map. Similarly, order is not preserved in maps, hence I considered the 2 possible permutation patterns of the string representation of the map.

@kaiyaok2 kaiyaok2 merged commit 70b45ad into master Feb 7, 2022
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.

1 participant