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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to