Skip to content

test: make org.jbpm.kie.services.test.RuntimeDataServiceImplSecurityTest deterministic#2498

Open
Jack-LuoHongyi wants to merge 1 commit into
kiegroup:mainfrom
Jack-LuoHongyi:test/deterministic-runtimedataservice-security
Open

test: make org.jbpm.kie.services.test.RuntimeDataServiceImplSecurityTest deterministic#2498
Jack-LuoHongyi wants to merge 1 commit into
kiegroup:mainfrom
Jack-LuoHongyi:test/deterministic-runtimedataservice-security

Conversation

@Jack-LuoHongyi

Copy link
Copy Markdown

Summary

  • Type: deterministic comparison (descriptor-order)
  • Scope: test-only; no production changes
  • Module: jbpm-services/jbpm-kie-services
  • Test: org.jbpm.kie.services.test.RuntimeDataServiceImplSecurityTest

Root Cause
DeploymentDescriptorImpl.toXml() relies on Set iteration order. NonDex shuffles that order and the generated XML violates the schema (required-roles and listener elements out of place), causing all 19 tests to fail in @Before with marshal errors.

Fix
Generate the deployment descriptor via an explicit XML string method to ensure the required role is always present in a stable order. This mirrors exactly what the builder produces when iteration happens to be ordered, so the checks still cover the same behavior—no assertions removed, no paths skipped. By eliminating the random serialization order we preserve the full test coverage while making the fixture deterministic.

Validation

  • Local unit test continues to pass consistently.
  • NonDex runs succeed across multiple executions(100 runs).
  • Impact is limited strictly to the test fixture.

Risk
Low. Stabilizing XML output removes order randomness without reducing assertions or test scope.

@fjtirado

fjtirado commented Dec 17, 2025

Copy link
Copy Markdown
Contributor

@Jack-LuoHongyi
Which is the set that shuffles the context of he DeploymentDescriptor?. I feel this PR and all related ones that you opened for several test cases should be fixed by changing toXml method to maintain insertion order rather than expanding the XML on each test.

@Jack-LuoHongyi

Copy link
Copy Markdown
Author

@fjtirado I’ve drafted an initial solution that applies the ordering fix inside our own DeploymentDescriptorIO#toXml() method. This keeps the descriptor XML schema-compliant no matter the iteration order. The only issue is that the original implementation is part of org.kie:kie-internal, which we use as an external dependency, so I can’t change it directly in this repository. I’m testing the in-repo override (including NonDex) to ensure it doesn’t cause any regressions. If all the checks pass, I’ll share the final patch.

@Jack-LuoHongyi

Copy link
Copy Markdown
Author

@fjtirado review #2500 please.

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.

2 participants