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 some flaky tests #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MundaneImmortal
Copy link

@MundaneImmortal MundaneImmortal commented Apr 2, 2022

Description
More than 10 tests in com.huawei.dmestore.services.DmeAccessServiceImplTest may fail due to the non-deterministic order of iteration of HashMap. Specifically, the toJson() used to convert the HashMap requestbody into a JSONString will iterate the HashMap not necessarily in the order of that of putting elements.
One can check the problem using NonDex :

mvn install -pl dmestore-service -am -DskipTests
mvn edu.illinois:nondex-maven-plugin:1.1.2:nondex -pl dmestore-service -Dtest=com.huawei.dmestore.services.DmeAccessServiceImplTest

Solution
Use LinkedHashMap instead of HashMap when initializing the variable requestbody so that it can be converted into a JSONString as desired.

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