Update PropertiesSheetListener.java #5610
Merged
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.
PR Overview:
This PR fixes the flaky/non-deterministic behavior of the following test because it assumes the ordering.
org.drools.decisiontable.parser.RuleWorksheetParseFromFileTest#testWorkbookParse
org.drools.decisiontable.parser.RuleWorksheetParse2Test#packageLevelAttributesShouldNotBeDuplicated
Test Overview:
In the above tests, the tests make an internal call to the PropertiesSheetListener.java. PropertiesSheetListener file has _rowProperties map that has been initialized as HashMap which is flaky in nature. This causes the above tests to fail.
This flakiness was identified by the nondex tool created by the researchers of UIUC.
You can reproduce the issue by running the following commands (you can reproduce the error for other tests by changing the test):
Fix:
To fix the issue I have changed the HashSet with LinkedHashSet which is deterministic in nature.
https://github.com/njain2208/incubator-kie-drools/blob/9b243b3fa1b290117441675118409f99b46d0e8b/drools-decisiontables/src/main/java/org/drools/decisiontable/parser/xls/PropertiesSheetListener.java#L44