Use Collection.Sort and compare the contents of the list to fix the flaky test#1
Open
prathyushreddylpr wants to merge 2 commits into
Open
Use Collection.Sort and compare the contents of the list to fix the flaky test#1prathyushreddylpr wants to merge 2 commits into
prathyushreddylpr wants to merge 2 commits into
Conversation
|
|
You can proceed to open a real PR. Once you open a real PR, please mark this tentative PR as |
|
The fix is simple enough, I think it's a good fix. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixed the flaky test
testGetFilesinsideFileUtilsTest.javaclass.cxf/core/src/test/java/org/apache/cxf/helpers/FileUtilsTest.java
Line 70 in 1a02ba3
Root Cause
The test
testGetFileshas been reported as flaky when run with the NonDex tool. The test failed because it is trying to compare contents in two lists, but since the order is not maintained in lists the assert is failing. The List in Java is implemented in such a way that it does not store the order in which the values are inserted. As a result, when both the lists are compared, it caused the failure.Fix
This test is fixed by first sorting the two lists and then comparing both lists.
How this has been tested?
Java: openjdk version "11.0.20.1"
Maven: Apache Maven 3.6.3
Command used -
Command used -
Command used -
NonDex test passed after the fix.