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 testSetAll #4998

Merged
merged 1 commit into from
Dec 4, 2023

Conversation

219sansim
Copy link
Contributor

@219sansim 219sansim commented Dec 4, 2023

Motivation:

Problem
The testSetAll unit test checks output of MultiMap which compares output of MultiMap and unintentionally checks for the order of the elements of output of MultiMap.toString() method. This may cause the following tests to sometimes fail even though the code under test may be working as expected -

io.vertx.core.http.headers.CaseInsensitiveHeadersTest#testSetAll
io.vertx.core.http.headers.VertxHttpHeadersTest#testSetAll

Solution
The solution is to check for both possible orderings of MultiMap which may be outputs of toString() method

Reproduction of Bug

Setup the NonDex tool and run

mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=io.vertx.core.http.headers.CaseInsensitiveHeadersTest#testSetAll -DnondexRuns=10
mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=io.vertx.core.http.headers.VertxHttpHeadersTest#testSetAll -DnondexRuns=10

Error Message

Tests run: 84, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.007 sec <<< FAILURE! - in io.vertx.core.http.headers.CaseInsensitiveHeadersTest
testSetAll(io.vertx.core.http.headers.CaseInsensitiveHeadersTest)  Time elapsed: 0.001 sec  <<< FAILURE!
org.junit.ComparisonFailure: expected:<[=
aaa=bbb]
> but was:<[aaa=bbb
=]
>

@tsegismont tsegismont merged commit bb36217 into eclipse-vertx:master Dec 4, 2023
4 of 7 checks passed
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