Skip to content
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

Fix Flaky MockDAOTest #83

Merged
merged 2 commits into from
Oct 25, 2021
Merged

Fix Flaky MockDAOTest #83

merged 2 commits into from
Oct 25, 2021

Conversation

HildoYe
Copy link
Contributor

@HildoYe HildoYe commented Oct 24, 2021

Have you read the docs first?
Yes

OK, describe you changes:
The test com.erudika.para.persistence.MockDAOTest#testReadPage is Flaky. It is failing when run several times with different initial random seeds. The root cause is when reading DAO to pages it assumes the MAPS is ordered while it is not.
The ConcurrentHashMap class does not guarantee the order of map when accessing it each time. This solution is to sort the Map before working on order dependent jobs.

Tests?
The test I use is mvn -pl para-server edu.illinois:nondex-maven-plugin:1.1.2:nondex -Dtest=com.erudika.para.persistence.MockDAOTest#testReadPage. You can also specify the number of runs with -DnondexRuns=NUMBER

@HildoYe HildoYe changed the title Using a ordered map Fix Flaky MockDAOTest Oct 25, 2021
@albogdano albogdano merged commit c07db0b into Erudika:master Oct 25, 2021
@albogdano
Copy link
Member

Thanks a lot for the fix!

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.

2 participants