Repository navigation
Fixing flaky test in AlignmentToolsTest.java - #906
Closed
Vidishab18 wants to merge 1 commit into
Closed
Vidishab18 wants to merge 1 commit into
Vidishab18 wants to merge 1 commit into
Conversation
Member
|
I created #907 to discuss the issue behind this PR. |
sbliven
requested changes
Dec 7, 2020
sbliven
left a comment
Member
There was a problem hiding this comment.
Did you run this patch against your test tool? The first thing toConciseAlignmentString does is copy the input to a HashMap, so changing the input to LinkedHashMap should not make a difference.
I think a better solution is to copy input into a TreeMap within toConciseAlignmentString to ensure ordered enumeration.
Contributor
|
This has been inactive a long time. I'll close |
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.
The test
AlignmentToolsTest#testToConciseAlignmentStringis flaky due to the order dependence inAlignmentToolsclasstoConciseAlignmentStringmethod inS seedNode = alig.keySet().iterator().next();to which the HashMap is passed from the testtestToConciseAlignmentString. Due to the non-deterministic order of iteration, it can be produce different structures since the Oracle specification about HashMap says that "This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time." The documentation is here for your reference:https://docs.oracle.com/javase/8/docs/api/java/util/HashMap.htmlThe retrieval of the elements using keySet() can be non-deterministic for a HashMap and can cause
AlignmentToolsTest#testToConciseAlignmentStringto be a flaky test. The HashMap is now replaced with the LinkedHashMap so that the non-deterministic iteration order of HashMap is eliminated.