pulsar icon indicating copy to clipboard operation
pulsar copied to clipboard

[improve][test] Add randomized TripleLongPriorityQueue correctness test

Open void-ptr974 opened this issue 5 months ago • 3 comments

Motivation

TripleLongPriorityQueue relies on heap ordering across three long fields. The existing tests cover basic ordering cases, and this adds broader randomized coverage with a reproducible seed for interleaved add/pop sequences.

Modifications

  • Add a randomized interleaved add/pop test against a JDK PriorityQueue oracle.
  • Include edge-case tuple values such as Long.MIN_VALUE and Long.MAX_VALUE.
  • Print the randomized test seed and support reproducing failures with -Dpulsar.collections.randomSeed=<seed>.

Verification

  • ./gradlew :pulsar-common:test --tests org.apache.pulsar.common.util.collections.TripleLongPriorityQueueTest -PtestRetryCount=0 -Dpulsar.collections.randomSeed=123456789
  • ./gradlew :pulsar-common:checkstyleTest

void-ptr974 avatar Jun 13 '26 11:06 void-ptr974

PR to restore fastutil is #26032

lhotari avatar Jun 15 '26 16:06 lhotari

@void-ptr974 #26032 has been merged. Please rebase. I guess tests for removed classes are now unnecessary, but this PR does contain tests for classes that remain so it will be useful.

lhotari avatar Jun 16 '26 22:06 lhotari

Thanks for the heads-up.

I removed the tests for the classes that no longer exist, so this PR now just adds the randomized coverage for TripleLongPriorityQueue.

void-ptr974 avatar Jun 17 '26 00:06 void-ptr974