8000 Fix Flaky Test in CaseServiceImplTest.testStartExpressionCaseWithCaseFile by Md-Arif-Hasan · Pull Request #2456 · kiegroup/jbpm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix Flaky Test in CaseServiceImplTest.testStartExpressionCaseWithCaseFile #2456

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Md-Arif-Hasan
Copy link

Purpose

This pull request fixes a flaky test:
CaseServiceImplTest.testStartExpressionCaseWithCaseFile- which was failing intermittently due to inconsistent behavior in case data evaluation and task assignment, likely caused by non-deterministic Map ordering and timing-related behavior.

Root Cause

The test used a standard HashMap to populate case file data, which does not guarantee key order. Under different JVM executions or shuffling (e.g., NonDex), the internal structure of the case file may behave unpredictably, leading to test failures or unexpected values.

How to Reproduce the Failure

Run the test with NonDex to simulate non-determinism:

mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex \
  -Dtest=org.jbpm.casemgmt.impl.CaseServiceImplTest#testStartExpressionCaseWithCaseFile
 

Fix Summary

Used LinkedHashMap Instead of HashMap
Replaced HashMap with LinkedHashMap to preserve insertion order and ensure deterministic case file creation.

Map<String, Object> data = new LinkedHashMap<>();

No Functional Changes

  • Business logic remains unchanged. The fix improves test stability and determinism.

Validation

Local test run - ✅ Passed
NonDex run - 	✅ Passed consistently

Commands used:

mvn -Dtest=org.jbpm.casemgmt.impl.CaseServiceImplTest#testStartExpressionCaseWithCaseFile test

mvn edu.illinois:nondex-maven-plugin:2.1.1:nondex \
  -Dtest=org.jbpm.casemgmt.impl.CaseServiceImplTest#testStartExpressionCaseWithCaseFile

Additional Notes

  • This fix improves reliability in CI environments with NonDex or parallel executions.
    
  • The test is now resilient to JVM-level data ordering variations.
    

Let me know if any further changes or reviews are needed!

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.

1 participant
0