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

Update PropertiesSheetListener.java #5610

Merged
merged 1 commit into from
Dec 6, 2023

Conversation

njain2208
Copy link
Contributor

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.

[ERROR]   RuleWorksheetParse2Test.packageLevelAttributesShouldNotBeDuplicated:165 
Expecting throwable message:
  "Multiple values for AGENDA-GROUP in cells [C4, C3]"
to contain:
  "C3, C4"
but did not.

[ERROR] Failures: 
[ERROR]   RuleWorksheetParseFromFileTest.testWorkbookParse:98 
Actual and expected have the same elements but not in the same order, at index 0 actual element was:
  "lah.di.dah"
whereas expected element was:
  "blah.class1"

You can reproduce the issue by running the following commands (you can reproduce the error for other tests by changing the test):

mvn install -pl  drools-decisiontables  -am -DskipTests
mvn test -pl drools-decisiontables  -Dtest=org.drools.decisiontable.parser.RuleWorksheetParseFromFileTest#testWorkbookParse
mvn -pl drools-decisiontables edu.illinois:nondex-maven-plugin:2.1.1:nondex -Dtest=org.drools.decisiontable.parser.RuleWorksheetParseFromFileTest#testWorkbookParse

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

Copy link
Contributor

@tkobayas tkobayas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@mariofusco mariofusco merged commit 4703e12 into apache:main Dec 6, 2023
8 of 9 checks passed
rgdoliveira pushed a commit to kiegroup/drools that referenced this pull request Dec 13, 2023
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.

3 participants