Skip to content

Conversation

@lbh930
Copy link

@lbh930 lbh930 commented Nov 18, 2025

Description

Modified LongConvertorFieldsTest.java to sort the serialized fields before comparing them with the expected output. This ensures that the test is deterministic and doesn't depend on the iteration order of Class.getDeclaredFields() which don't have guarantee in consistency.

Motivation

NonDex detected test flakiness in 5 tests:

  • net.openhft.chronicle.wire.converter.LongConvertorFieldsTest.base16
  • net.openhft.chronicle.wire.converter.LongConvertorFieldsTest.base64
  • net.openhft.chronicle.wire.converter.LongConvertorFieldsTest.base85
  • net.openhft.chronicle.wire.converter.LongConvertorFieldsTest.shortText
  • net.openhft.chronicle.wire.converter.LongConvertorFieldsTest.words

This PR is verified by NonDex to fix them all. The root cause was that the tests asserted a specific order of fields in the serialized YAML string. Since SelfDescribingMarshallable uses reflection to discover fields, the order is not guaranteed. An example of NonDex output with detected test failure is attached.
nondex_output.txt

@lbh930 lbh930 force-pushed the fix_long_convertor_fields_test branch from 8fc540e to 6523ece Compare December 2, 2025 20:00
@lbh930
Copy link
Author

lbh930 commented Dec 2, 2025

I updated the PR to make the changes smaller.

@lbh930 lbh930 changed the title De-flake LongConvertorFieldsTest by removing dependence on field orde… Fix flaky tests in LongConvertorFieldsTest by removing dependence on field orde… Dec 2, 2025
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