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

Fix non deterministic test - RoleTest#testRole_InitAndSerialize #13981

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

Conversation

mohitbadve
Copy link

@mohitbadve mohitbadve commented Nov 3, 2024

Description

The test org.apache.iotdb.db.auth.entity.RoleTest#testRole_InitAndSerialize fails under NonDex tool which detects non-deterministic nature of tests with when non-deterministic data structures are used. The failure behavior is defined by non-deterministic ordering of pathPrivilegeList and systemPrivilegeSet.

How to Reproduce

mvn -pl iotdb-core/datanode edu.illinois:nondex-maven-plugin:2.1.7:nondex 
-Dtest=RoleTest#testRole_InitAndSerialize 
-DnondexRuns=10

Error

[INFO] Running org.apache.iotdb.db.auth.entity.RoleTest
[ERROR] Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.312 s <<< FAILURE! -- in org.apache.iotdb.db.auth.entity.RoleTest
[ERROR] org.apache.iotdb.db.auth.entity.RoleTest.testRole_InitAndSerialize -- Time elapsed: 0.267 s <<< FAILURE!
org.junit.ComparisonFailure: expected:<...legeList=[root.ln : [WRITE_DATA READ_SCHEMA_with_grant_option]], systemPrivilegeSe...> but was:<...legeList=[root.ln : [READ_SCHEMA_with_grant_option WRITE_DATA]], systemPrivilegeSe...>
	at org.junit.Assert.assertEquals(Assert.java:117)
	at org.junit.Assert.assertEquals(Assert.java:146)
	at org.apache.iotdb.db.auth.entity.RoleTest.testRole_InitAndSerialize(RoleTest.java:48) ...

Proposed Solution

Assert the role.toString by handling the above catch. Extract and assert the list and set instead of asserting string directly.
Please let me know if you have any questions or need any additional justification/changes from my side.


This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious
    for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold
    for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR

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