Skip to content

test: make org.jbpm.kie.services.impl.admin.ProcessInstanceAdminServiceImplTest.testGetNodes deterministic - #2474

Closed
Jack-LuoHongyi wants to merge 1 commit into
kiegroup:mainfrom
Jack-LuoHongyi:test/deterministic-processinstanceadmin-getnodes
Closed

test: make org.jbpm.kie.services.impl.admin.ProcessInstanceAdminServiceImplTest.testGetNodes deterministic#2474
Jack-LuoHongyi wants to merge 1 commit into
kiegroup:mainfrom
Jack-LuoHongyi:test/deterministic-processinstanceadmin-getnodes

Conversation

@Jack-LuoHongyi

Copy link
Copy Markdown

Summary

  • Type: deterministic comparison (schema/iteration-order)
  • Scope: test-only; no production changes
  • Module: jbpm-services/jbpm-kie-services
  • Test: org.jbpm.kie.services.impl.admin.ProcessInstanceAdminServiceImplTest#testGetNodes

Root Cause
JAXB serialization of the deployment descriptor is order-sensitive with respect to the schema. When collection iteration order varies, the marshaller can emit elements (e.g., audit-persistence-unit) before expected groups, leading to schema validation errors during descriptor generation. This manifests as intermittent test failures when the iteration order differs across runs.

Fix
Provide a pre-rendered kie-deployment-descriptor.xml in the test fixture (StableDescriptorXml) and add it via extraResources when building the test KJAR. The XML mirrors the descriptor produced by AbstractKieServicesTest#createDeploymentDescriptor() for this test (including the event listener), ensuring stable, schema-compliant element order without changing any runtime behavior or assertions.

Validation

  • Local: mvn -pl jbpm-services/jbpm-kie-services -Dtest=org.jbpm.kie.services.impl.admin.ProcessInstanceAdminServiceImplTest#testGetNodes test passes consistently
  • Assertions unchanged: still validates node count (8) and name→type map

Risk
Low. Test-only resource injection; no production classes modified. The descriptor content is equivalent, just rendered with a stable element order.

@Jack-LuoHongyi Jack-LuoHongyi changed the title test: make org.jbpm.kie.services.impl.admin.ProcessInstanceAdminServiceImplTest deterministic test: org.jbpm.kie.services.impl.admin.ProcessInstanceAdminServiceImplTest.testGetNodes deterministic Sep 30, 2025
@Jack-LuoHongyi Jack-LuoHongyi changed the title test: org.jbpm.kie.services.impl.admin.ProcessInstanceAdminServiceImplTest.testGetNodes deterministic test: make org.jbpm.kie.services.impl.admin.ProcessInstanceAdminServiceImplTest.testGetNodes deterministic Sep 30, 2025
@Jack-LuoHongyi

Jack-LuoHongyi commented Oct 26, 2025

Copy link
Copy Markdown
Author

a more complete solution in #2487

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