You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fory.apache.org by "swj20010308 (via GitHub)" <gi...@apache.org> on 2025/10/02 18:30:28 UTC

[PR] fix(java): Fix flakiness in CollectionSerializersTest#tesPriorityQueueSerializer [fory]

swj20010308 opened a new pull request, #2693:
URL: https://github.com/apache/fory/pull/2693

   ## What does this PR do?
   
   `CollectionSerializersTest#tesPriorityQueueSerializer` tries to compare the content of a PriorityQueue to an expected ImmutableList using `ImmutableList.copyOf()`, but the PriorityQueue is based on a heap and does not guarrentee any ordering in its underlying data structures. Therefore the `toArray()` method which `copyOf()` invokes will return non-deterministic results. 
   
   We can reproduce this non-deterministic failure with [NonDex](https://github.com/TestingResearchIllinois/NonDex):
   ```
   mvn -pl fory-core edu.illinois:nondex-maven-plugin:2.1.7:nondex -Dtest=org.apache.fory.serializer.collection.CollectionSerializersTest#tesPriorityQueueSerializer
   ```
   This PR uses `sortedCopyOf()` instead to enforce the ordering of elememts in the new ImmutableList, which removes the flakiness. 
   
   This change does not weaken the test in any way because a PriorityQueue preserves natural ordering in the absence of a Comparator (when using `poll()`, for example) which is equivalent to sorting the elements in this case.
   
   ## Does this PR introduce any user-facing change?
   
   No
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org


Re: [PR] fix(java): Fix flakiness in CollectionSerializersTest#tesPriorityQueueSerializer [fory]

Posted by "chaokunyang (via GitHub)" <gi...@apache.org>.
chaokunyang merged PR #2693:
URL: https://github.com/apache/fory/pull/2693


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fory.apache.org
For additional commands, e-mail: commits-help@fory.apache.org