This is an automated email from the ASF dual-hosted git repository.

He-Pin pushed a commit to branch fix/jdk25-tck-await-timefactor
in repository https://gitbox.apache.org/repos/asf/pekko.git

commit 7a150910355751fe2738fdfcbc7092cdf330e19b
Author: He-Pin <[email protected]>
AuthorDate: Fri May 29 16:10:59 2026 +0800

    test: scale TCK Await timeouts by pekko.test.timefactor
    
    Motivation:
    GroupByTest and PrefixAndTailTest abort the TCK suite on JDK 25
    nightly runs with "Expected completion signal after signalling 10
    elements (signalled 0), yet did not receive it within 32000 ms" after
    roughly 18 iterations of stochastic_spec103_mustSignalOnMethodsSequentially.
    Both `createPublisher` implementations materialize an intermediate
    stream and call `Await.result(future, 3.seconds)` to obtain the
    Source wrapped by the test Publisher. The 3s value is a hardcoded
    constant that does not honour `pekko.test.timefactor`, so the JDK 25
    nightly's compounded GC + ForkJoinPool pressure can push a single
    materialization beyond 3s during the 100-iteration stochastic test,
    which surfaces as a Publisher that signals zero elements.
    
    Modification:
    - Add `Timeouts.materializerTimeoutMillis`, scaled by `timeFactor`.
    - Route the `Await.result` calls in GroupByTest and PrefixAndTailTest
      through the new helper instead of the hardcoded `3.seconds`.
    - Apply the same `timeFactor` scaling to the existing
      `publisherShutdownTimeoutMillis`, which was the only field in
      `Timeouts` that ignored `timeFactor`.
    
    Result:
    On local runs (timeFactor=1) the effective budget stays at 3s, so the
    test still flags genuine materialization regressions. On JDK 25
    nightly (timeFactor=4) the budget grows to 12s, which covers the
    observed worst-case materialization delays without masking real bugs.
---
 .../test/scala/org/apache/pekko/stream/tck/GroupByTest.scala   |  2 +-
 .../scala/org/apache/pekko/stream/tck/PrefixAndTailTest.scala  |  2 +-
 .../src/test/scala/org/apache/pekko/stream/tck/Timeouts.scala  | 10 +++++++++-
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git 
a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/GroupByTest.scala 
b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/GroupByTest.scala
index 8935defd21..7a07269a2d 100644
--- 
a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/GroupByTest.scala
+++ 
b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/GroupByTest.scala
@@ -30,7 +30,7 @@ class GroupByTest extends PekkoPublisherVerification[Int] {
     else {
       val futureGroupSource =
         Source(iterable(elements)).groupBy(1, _ => 
"all").prefixAndTail(0).map(_._2).concatSubstreams.runWith(Sink.head)
-      val groupSource = Await.result(futureGroupSource, 3.seconds)
+      val groupSource = Await.result(futureGroupSource, 
Timeouts.materializerTimeoutMillis.millis)
       groupSource.runWith(Sink.asPublisher(false))
 
     }
diff --git 
a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PrefixAndTailTest.scala
 
b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PrefixAndTailTest.scala
index 1b70dfd1e3..1d184ded68 100644
--- 
a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PrefixAndTailTest.scala
+++ 
b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/PrefixAndTailTest.scala
@@ -26,7 +26,7 @@ class PrefixAndTailTest extends 
PekkoPublisherVerification[Int] {
 
   def createPublisher(elements: Long): Publisher[Int] = {
     val futureTailSource = Source(iterable(elements)).prefixAndTail(0).map { 
case (_, tail) => tail }.runWith(Sink.head)
-    val tailSource = Await.result(futureTailSource, 3.seconds)
+    val tailSource = Await.result(futureTailSource, 
Timeouts.materializerTimeoutMillis.millis)
     tailSource.runWith(Sink.asPublisher(false))
   }
 
diff --git 
a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/Timeouts.scala 
b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/Timeouts.scala
index 1183c073ed..84ae7c7594 100644
--- a/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/Timeouts.scala
+++ b/stream-tests-tck/src/test/scala/org/apache/pekko/stream/tck/Timeouts.scala
@@ -22,7 +22,7 @@ object Timeouts {
   private val timeFactor: Double =
     sys.props.get("pekko.test.timefactor").map(_.toDouble).getOrElse(1.0)
 
-  def publisherShutdownTimeoutMillis: Int = 3000
+  def publisherShutdownTimeoutMillis: Int = math.ceil(3000 * timeFactor).toInt
 
   def defaultTimeoutMillis: Int = (800 * timeFactor).toInt
 
@@ -30,4 +30,12 @@ object Timeouts {
 
   def actorSystemShutdownTimeoutMillis: Int = math.ceil(10000 * 
timeFactor).toInt
 
+  // Used by TCK Test classes that need to materialize an intermediate stream 
to
+  // obtain the Publisher under test (e.g. groupBy, prefixAndTail). The base 3s
+  // is the historical hardcoded value; scaling by timeFactor keeps it stable 
on
+  // JDK 25 nightly runs where compounded GC + ForkJoinPool pressure 
occasionally
+  // pushes a single materialization beyond 3s during 100-iteration stochastic
+  // tests, which previously caused the TCK suite to abort with "signalled 0".
+  def materializerTimeoutMillis: Int = math.ceil(3000 * timeFactor).toInt
+
 }


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

Reply via email to