Skip to content

[BUG] - Nondeterminism in unit test TestThreadPoolPublishModelFactory due to JSON parameter ordering #4968

@anthonyx24

Description

@anthonyx24

Steps to Reproduce

This is the same issue as #4946 for a different class, since there is also a JSON string comparison here. In summary, since JSONs are unordered, after converting them to strings, the parameter ordering is not guaranteed. For another example of this issue being addressed, see this previous merged PR.

This test was flagged via the NonDex tool, which detects potentially unreliable tests due to underlying Java API assumptions. To see the Nondex output for this test, you can run:

mvn -pl metrics/metrics-core edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest="org.apache.servicecomb.metrics.core.publish.TestThreadPoolPublishModelFactory#createDefaultPublishModel"

Expected Behavior

The test should pass regardless of JSON parameter ordering, since it's just checking that the object was created with the right initial values.

Servicecomb Version

3.3.0

Additional Context

I have a potential fix in a PR, I'll be adding that to the discussion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions