[WFCORE-6214] Fixed Flaky Test HelpSupportTestCase.testStandalone #5365
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.
What is the purpose of this PR
org.jboss.as.cli.impl.aesh.HelpSupportTestCase
HashSet
's non-deterministic iteration order.Why the test fails
HelpSupportTestCase
callsSynopsisGenerator
, which uses aHashSet
as its data structure for the conflicts object. As per Java 11 documentation, the ordering ofHashSet
is not constant, so assigning the sameHashSet
as an array to different objects can change the ordering. So, when comparing these two arrays withassertEquals
the test may fail as the given order can be different from the expected order.Reproduce the test failure
NonDex
maven plugin. The command to recreate the flaky test failure ismvn -pl cli edu.illinois:nondex-maven-plugin:2.1.1:nondex - Dtest=org.jboss.as.cli.impl.aesh.HelpSupportTestCase#testStandalone
Expected result
NonDex
.<...server-groups] | [--[replace] | [--server-groups]] )>
Actual Result
testStandalone(org.jboss.as.cli.impl.aesh.HelpSupportTestCase)
Time elapsed: 0.254 s <<< FAILURE!org.junit.ComparisonFailure
:org.jboss.as.cli.impl.aesh.Commands$Standalone$Command10
. EXPECTED[command1 [<argument>] ( [--all-server-groups] | [--replace] | [--server-groups] )]
. FOUND[command1 [<argument>] ( [--all-server-groups] | [--server-groups] | [--replace] )]
expected:<...server-groups] | [--[replace] | [--server-groups]] )>
but was:<...server-groups] | [--[server-groups] | [--replace]] )>
Fix
conflicts
andconflicts2
objects fromHashSet
toLinkedHashSet
in methodSynopsisGenerator.addSynopsisOption(SynopsisOption)
and importedLinkedHashSet
.This PR is similar to some merged PRs in other wildfly projects:
wildfly/wildfly#13728
wildfly/wildfly#11833
wildfly/jboss-ejb-client#534
Jira Issue:
https://issues.redhat.com/browse/WFCORE-6214