Fixed 35 different flaky tests with ID category #4783
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.
These tests are failing NonDex since they're directly comparing JSON Strings which can have different key order when run multiple times.
Click on to see more details on the error message
All the tests I fixed have similar issues, so reproducing them requires similar steps. For example, for the
testFormatOfDecimal
function located inio/swagger/v3/core/converting/NumericFormatTest.java
, Here's the steps to reproduce:Run this at the root directory:
mvn -pl modules/swagger-core edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=io.swagger.v3.core.converting.NumericFormatTest#testFormatOfDecimal -DnondexRuns=1
(Note: The failing test might not be seen if every test happens to have the JSON string in the correct order. Try running it several times or increase the the number of runs with
-DnondexRuns=
to reproduce the issue.)To fix this, I converted the actual and expected JSON String into JSON objects and compare with
JSONAssert.assertEquals
, which ensures correct equality checks regardless of key order.