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

ifesdjeen pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/cassandra-simulator.git

commit 5afc46e2bd3943e64c1c0d07ac145fb84a3fd390
Author: Alex Petrov <[email protected]>
AuthorDate: Wed Jul 22 10:18:11 2026 +0200

    Minor improvements
---
 .../InstrumentedCassandraCountDownLatch.java       |  1 -
 .../CassandraCountDownLatchStepApiTest.java        |  9 +++++-
 .../InstrumentedCassandraCountDownLatchTest.java   | 13 ++++++--
 .../cassandra/simulator_test/IoStepApiTest.java    | 11 +++++--
 .../PluggablePrimitiveIntegrationTest.java         | 25 +++++++++++----
 .../step/LockSupportParkUnparkTest.java            | 12 +++++--
 .../simulator_test/step/MonitorEnterTest.java      | 10 +++++-
 .../simulator_test/step/NemesisYieldTest.java      | 37 +++++++++++++---------
 .../simulator_test/step/ObjectWaitNotifyTest.java  | 10 +++++-
 .../simulator_test/step/StepApiTestSupport.java    | 10 ++----
 .../simulator_test/step/ThreadSleepTest.java       | 10 +++++-
 .../simulator_test/step/ThreadStartTest.java       |  9 +++++-
 12 files changed, 113 insertions(+), 44 deletions(-)

diff --git 
a/integration-test/src/main/java/org/apache/cassandra/simulator/systems/InstrumentedCassandraCountDownLatch.java
 
b/integration-test/src/main/java/org/apache/cassandra/simulator/systems/InstrumentedCassandraCountDownLatch.java
index 542ae0a..a2701b8 100644
--- 
a/integration-test/src/main/java/org/apache/cassandra/simulator/systems/InstrumentedCassandraCountDownLatch.java
+++ 
b/integration-test/src/main/java/org/apache/cassandra/simulator/systems/InstrumentedCassandraCountDownLatch.java
@@ -30,7 +30,6 @@ public class InstrumentedCassandraCountDownLatch extends 
InterceptingAwaitable.I
     public static final String DECREMENT = 
"cassandra.count_down_latch.decrement";
 
     private final AtomicInteger count;
-
     public InstrumentedCassandraCountDownLatch(int n)
     {
         this.count = new AtomicInteger(n);
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/CassandraCountDownLatchStepApiTest.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/CassandraCountDownLatchStepApiTest.java
index 0b0a3ac..ba359a2 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/CassandraCountDownLatchStepApiTest.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/CassandraCountDownLatchStepApiTest.java
@@ -36,10 +36,17 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  */
 public class CassandraCountDownLatchStepApiTest extends StepApiTestSupport
 {
+    private static Simulator instrumentedSimulator(long seed)
+    {
+        Simulator sim = new Simulator(seed);
+        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
+        return sim;
+    }
+
     @Test
     void cassandraCountDownLatch_awaitSuspendsUntilDecrement()
     {
-        try (Simulator sim = simulator(42L);
+        try (Simulator sim = instrumentedSimulator(42L);
              Session session = sim.byStep((SerializableRunnable) () ->
         {
             var latch = CassandraCountDownLatch.newCountDownLatch(1);
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/InstrumentedCassandraCountDownLatchTest.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/InstrumentedCassandraCountDownLatchTest.java
index c81969f..09a2a91 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/InstrumentedCassandraCountDownLatchTest.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/InstrumentedCassandraCountDownLatchTest.java
@@ -38,10 +38,17 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  */
 public class InstrumentedCassandraCountDownLatchTest extends StepApiTestSupport
 {
+    private static Simulator instrumentedSimulator(long seed, float 
monitorDelayChance)
+    {
+        Simulator sim = new Simulator(seed, monitorDelayChance);
+        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
+        return sim;
+    }
+
     @Test
     void await_blocksUntilDecrement()
     {
-        try (Simulator sim = simulator(42L, 1.0f);
+        try (Simulator sim = instrumentedSimulator(42L, 1.0f);
              Session session = sim.byStep((SerializableRunnable) () -> {
                  var latch = CassandraCountDownLatch.newCountDownLatch(1);
 
@@ -83,7 +90,7 @@ public class InstrumentedCassandraCountDownLatchTest extends 
StepApiTestSupport
     @Test
     void await_requiresAllDecrements()
     {
-        try (Simulator sim = simulator(42L, 1.0f);
+        try (Simulator sim = instrumentedSimulator(42L, 1.0f);
              Session session = sim.byStep((SerializableRunnable) () -> {
                  int count = 3;
                  var latch = CassandraCountDownLatch.newCountDownLatch(count);
@@ -126,7 +133,7 @@ public class InstrumentedCassandraCountDownLatchTest 
extends StepApiTestSupport
     @Test
     void await_doesNotBlockWhenCountIsZero()
     {
-        try (Simulator sim = simulator(42L, 1.0f);
+        try (Simulator sim = instrumentedSimulator(42L, 1.0f);
              Session session = sim.byStep((SerializableRunnable) () -> {
                  var latch = CassandraCountDownLatch.newCountDownLatch(0);
 
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/IoStepApiTest.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/IoStepApiTest.java
index be4490b..680f463 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/IoStepApiTest.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/IoStepApiTest.java
@@ -75,7 +75,12 @@ public class IoStepApiTest
 
     private static Simulator simulator(long seed)
     {
-        Simulator sim = new Simulator(seed);
+        return new Simulator(seed);
+    }
+
+    private static Simulator instrumentedSimulator(long seed)
+    {
+        Simulator sim = simulator(seed);
         sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
         return sim;
     }
@@ -87,7 +92,7 @@ public class IoStepApiTest
         try
         {
             String pathString = path.toString();
-            try (Simulator sim = simulator(42L);
+            try (Simulator sim = instrumentedSimulator(42L);
                  Session session = sim.byStep((SerializableRunnable) () -> {
                 var done = CassandraCountDownLatch.newCountDownLatch(2);
 
@@ -301,7 +306,7 @@ public class IoStepApiTest
         try
         {
             String pathString = path.toString();
-            try (Simulator sim = simulator(42L);
+            try (Simulator sim = instrumentedSimulator(42L);
                  Session session = sim.byStep((SerializableRunnable) () -> {
                 var done = CassandraCountDownLatch.newCountDownLatch(2);
 
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/PluggablePrimitiveIntegrationTest.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/PluggablePrimitiveIntegrationTest.java
index 4219272..6a92005 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/PluggablePrimitiveIntegrationTest.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/PluggablePrimitiveIntegrationTest.java
@@ -39,8 +39,8 @@ import static org.junit.jupiter.api.Assertions.assertFalse;
 import static org.junit.jupiter.api.Assertions.assertTrue;
 
 /**
- * Verifies that all five Cassandra concurrency primitive registrations create
- * observable scheduling gates inside one simulator configuration.
+ * Verifies that each Cassandra concurrency primitive registration creates an
+ * observable scheduling gate.
  */
 public class PluggablePrimitiveIntegrationTest extends StepApiTestSupport
 {
@@ -48,17 +48,23 @@ public class PluggablePrimitiveIntegrationTest extends 
StepApiTestSupport
     {
         Simulator sim = new Simulator(42L, 1.0f);
         sim.intercept(WaitQueue.class, InstrumentedWaitQueue.class);
-        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
         sim.intercept(Condition.class, 
InterceptingAwaitable.InterceptingCondition.class);
         sim.intercept(Semaphore.class, "newSemaphore", n -> new 
InstrumentedSemaphore(n, false));
         sim.intercept(Semaphore.class, "newFairSemaphore", n -> new 
InstrumentedSemaphore(n, true));
         return sim;
     }
 
+    private static Simulator newSimWithInstrumentedCassandraCountDownLatch()
+    {
+        Simulator sim = newSim();
+        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
+        return sim;
+    }
+
     @Test
     void cassandraWaitQueue_signalWakesRegisteredWaiter()
     {
-        assertSingleWakeup((SerializableRunnable) () -> {
+        assertSingleWakeup(true, (SerializableRunnable) () -> {
             WaitQueue queue = WaitQueue.newWaitQueue();
             new Thread(() -> {
                 WaitQueue.Signal signal = queue.register();
@@ -76,7 +82,7 @@ public class PluggablePrimitiveIntegrationTest extends 
StepApiTestSupport
     @Test
     void cassandraCountDownLatch_awaitBlocksUntilDecrement()
     {
-        assertSingleWakeup((SerializableRunnable) () -> {
+        assertSingleWakeup(true, (SerializableRunnable) () -> {
             CassandraCountDownLatch latch = 
CassandraCountDownLatch.newCountDownLatch(1);
             new Thread(() -> {
                 SharedTestState.parkCount.incrementAndGet();
@@ -144,7 +150,7 @@ public class PluggablePrimitiveIntegrationTest extends 
StepApiTestSupport
     @Test
     void cassandraCountDownLatch_multipleDecrementsAllRequired()
     {
-        try (Simulator sim = newSim();
+        try (Simulator sim = newSimWithInstrumentedCassandraCountDownLatch();
              Session session = sim.byStep((SerializableRunnable) () -> {
                  int count = 3;
                  CassandraCountDownLatch latch = 
CassandraCountDownLatch.newCountDownLatch(count);
@@ -180,7 +186,12 @@ public class PluggablePrimitiveIntegrationTest extends 
StepApiTestSupport
 
     private static void assertSingleWakeup(SerializableRunnable runnable)
     {
-        try (Simulator sim = newSim();
+        assertSingleWakeup(false, runnable);
+    }
+
+    private static void assertSingleWakeup(boolean 
instrumentCassandraCountDownLatch, SerializableRunnable runnable)
+    {
+        try (Simulator sim = instrumentCassandraCountDownLatch ? 
newSimWithInstrumentedCassandraCountDownLatch() : newSim();
              Session session = sim.byStep(runnable).enableDebug())
         {
             assertEquals(0, SharedTestState.parkCount.get());
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/LockSupportParkUnparkTest.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/LockSupportParkUnparkTest.java
index 8125781..00296cb 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/LockSupportParkUnparkTest.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/LockSupportParkUnparkTest.java
@@ -25,6 +25,7 @@ import org.apache.cassandra.simulator.context.SharedTestState;
 import 
org.apache.cassandra.simulator.context.IIsolatedExecutor.SerializableRunnable;
 import org.apache.cassandra.simulator.step.ObservableAction;
 import org.apache.cassandra.simulator.step.Session;
+import 
org.apache.cassandra.simulator.systems.InstrumentedCassandraCountDownLatch;
 import org.apache.cassandra.utils.concurrent.CassandraCountDownLatch;
 import org.junit.jupiter.api.Test;
 
@@ -36,10 +37,17 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  */
 public class LockSupportParkUnparkTest extends StepApiTestSupport
 {
+    private static Simulator instrumentedSimulator(long seed)
+    {
+        Simulator sim = new Simulator(seed);
+        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
+        return sim;
+    }
+
     @Test
     void lockSupportPark_parkerSuspendsAndResumesViaUnpark()
     {
-        try (Simulator sim = simulator(42L);
+        try (Simulator sim = instrumentedSimulator(42L);
              Session session = sim.byStep((SerializableRunnable) () ->
         {
             // Thread.start() replaces the original Thread with an 
InterceptibleThread.
@@ -83,7 +91,7 @@ public class LockSupportParkUnparkTest extends 
StepApiTestSupport
     @Test
     void lockSupportParkNanos_nothingHappensWithoutStep()
     {
-        try (Simulator sim = simulator(42L);
+        try (Simulator sim = instrumentedSimulator(42L);
              Session session = sim.byStep((SerializableRunnable) () -> {
             Thread[] parkerRef = { null };
             var ready = CassandraCountDownLatch.newCountDownLatch(1);
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/MonitorEnterTest.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/MonitorEnterTest.java
index 69e605c..80ad36f 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/MonitorEnterTest.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/MonitorEnterTest.java
@@ -22,6 +22,7 @@ import org.apache.cassandra.simulator.Simulator;
 import org.apache.cassandra.simulator.context.SharedTestState;
 import 
org.apache.cassandra.simulator.context.IIsolatedExecutor.SerializableRunnable;
 import org.apache.cassandra.simulator.step.Session;
+import 
org.apache.cassandra.simulator.systems.InstrumentedCassandraCountDownLatch;
 import org.apache.cassandra.utils.concurrent.CassandraCountDownLatch;
 import org.junit.jupiter.api.Test;
 
@@ -33,10 +34,17 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  */
 public class MonitorEnterTest extends StepApiTestSupport
 {
+    private static Simulator instrumentedSimulator(long seed, float 
monitorDelayChance)
+    {
+        Simulator sim = new Simulator(seed, monitorDelayChance);
+        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
+        return sim;
+    }
+
     @Test
     void synchronizedBlock_monitorEntryIsSchedulingPoint()
     {
-        try (Simulator sim = simulator(42L, 1.0f);
+        try (Simulator sim = instrumentedSimulator(42L, 1.0f);
              Session session = sim.byStep((SerializableRunnable) () -> {
             Object lock = new Object();
             var done = CassandraCountDownLatch.newCountDownLatch(2);
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/NemesisYieldTest.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/NemesisYieldTest.java
index de1a02e..289f1ca 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/NemesisYieldTest.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/NemesisYieldTest.java
@@ -21,7 +21,10 @@ package org.apache.cassandra.simulator_test.step;
 import org.apache.cassandra.simulator.Simulator;
 import org.apache.cassandra.simulator.context.SharedTestState;
 import 
org.apache.cassandra.simulator.context.IIsolatedExecutor.SerializableRunnable;
+import org.apache.cassandra.simulator.step.ObservableAction;
 import org.apache.cassandra.simulator.step.Session;
+import 
org.apache.cassandra.simulator.systems.InstrumentedCassandraCountDownLatch;
+import 
org.apache.cassandra.simulator.systems.InterceptorOfSystemMethods.Global;
 import org.apache.cassandra.utils.concurrent.CassandraCountDownLatch;
 import org.junit.jupiter.api.Test;
 
@@ -33,16 +36,23 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  */
 public class NemesisYieldTest extends StepApiTestSupport
 {
+    private static Simulator instrumentedSimulator(long seed)
+    {
+        Simulator sim = new Simulator(seed);
+        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
+        return sim;
+    }
+
     @Test
     void nemesis_yieldsCallerAllowingOtherThreadToRun()
     {
-        try (Simulator sim = simulator(42L);
+        try (Simulator sim = instrumentedSimulator(42L);
              Session session = sim.byStep((SerializableRunnable) () ->
         {
             var done = CassandraCountDownLatch.newCountDownLatch(2);
 
             new Thread(() -> {
-                
org.apache.cassandra.simulator.systems.InterceptorOfSystemMethods.Global.nemesis(1.0f);
+                Global.nemesis(1.0f);
                 SharedTestState.threadRan.incrementAndGet();
                 done.decrement();
             }, "A").start();
@@ -53,24 +63,21 @@ public class NemesisYieldTest extends StepApiTestSupport
             }, "B").start();
 
             try { done.await(); } catch (InterruptedException e) { 
Thread.currentThread().interrupt(); }
-        }))
+        }).enableDebug())
         {
-            assertEquals(0, SharedTestState.threadRan.get(),  "A has not run 
yet");
+            ObservableAction nemesis = 
session.stepUntil(ObservableAction.Kind.NEMESIS_CAPTURED).orElseThrow();
+            assertTrue(nemesis.threadName().contains("A"));
+            assertEquals(0, SharedTestState.threadRan.get(),  "A is suspended 
at nemesis");
             assertEquals(0, SharedTestState.eventCount.get(), "B has not run 
yet");
 
-            assertTrue(session.stepThrough(1));
-            assertEquals(0, SharedTestState.threadRan.get(),  "A queued, not 
run");
-            assertEquals(0, SharedTestState.eventCount.get(), "B queued, not 
run");
-
-            assertTrue(session.stepThrough(1));
-            assertEquals(0, SharedTestState.threadRan.get(),  "A suspended at 
nemesis, not yet past it");
-
-            assertTrue(session.stepThrough(1));
+            ObservableAction otherThread = 
session.stepUntil(InstrumentedCassandraCountDownLatch.DECREMENT).orElseThrow();
+            assertTrue(otherThread.threadName().contains("B"));
             assertEquals(1, SharedTestState.eventCount.get(), "B ran while A 
was suspended at nemesis");
-            assertEquals(0, SharedTestState.threadRan.get(),  "A not yet 
resumed");
+            assertEquals(0, SharedTestState.threadRan.get(),  "A has not 
resumed");
 
-            assertTrue(session.stepThrough(1));
-            assertEquals(1, SharedTestState.threadRan.get(),  "A resumed and 
completed");
+            ObservableAction resumed = 
session.stepUntil(ObservableAction.Kind.WAKEUP_FIRED).orElseThrow();
+            assertEquals(Long.valueOf(nemesis.threadId()), 
resumed.targetThreadId());
+            assertEquals(1, SharedTestState.threadRan.get(), "A resumed after 
the nemesis wakeup");
         }
     }
 }
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ObjectWaitNotifyTest.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ObjectWaitNotifyTest.java
index 0a533c6..22ca37a 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ObjectWaitNotifyTest.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ObjectWaitNotifyTest.java
@@ -23,6 +23,7 @@ import org.apache.cassandra.simulator.context.SharedTestState;
 import 
org.apache.cassandra.simulator.context.IIsolatedExecutor.SerializableRunnable;
 import org.apache.cassandra.simulator.step.ObservableAction;
 import org.apache.cassandra.simulator.step.Session;
+import 
org.apache.cassandra.simulator.systems.InstrumentedCassandraCountDownLatch;
 import org.apache.cassandra.utils.concurrent.CassandraCountDownLatch;
 import org.junit.jupiter.api.Test;
 
@@ -34,10 +35,17 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  */
 public class ObjectWaitNotifyTest extends StepApiTestSupport
 {
+    private static Simulator instrumentedSimulator(long seed, float 
monitorDelayChance)
+    {
+        Simulator sim = new Simulator(seed, monitorDelayChance);
+        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
+        return sim;
+    }
+
     @Test
     void objectWaitNotify_waiterSuspendsAndResumesViaNotify()
     {
-        try (Simulator sim = simulator(42L, 1.0f);
+        try (Simulator sim = instrumentedSimulator(42L, 1.0f);
              Session session = sim.byStep((SerializableRunnable) () ->
         {
             Object lock = new Object();
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/StepApiTestSupport.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/StepApiTestSupport.java
index b11867c..b470039 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/StepApiTestSupport.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/StepApiTestSupport.java
@@ -20,8 +20,6 @@ package org.apache.cassandra.simulator_test.step;
 
 import org.apache.cassandra.simulator.Simulator;
 import org.apache.cassandra.simulator.context.SharedTestState;
-import 
org.apache.cassandra.simulator.systems.InstrumentedCassandraCountDownLatch;
-import org.apache.cassandra.utils.concurrent.CassandraCountDownLatch;
 import org.junit.jupiter.api.BeforeEach;
 
 public abstract class StepApiTestSupport
@@ -34,15 +32,11 @@ public abstract class StepApiTestSupport
 
     public static Simulator simulator(long seed)
     {
-        Simulator sim = new Simulator(seed);
-        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
-        return sim;
+        return new Simulator(seed);
     }
 
     public static Simulator simulator(long seed, float monitorDelayChance)
     {
-        Simulator sim = new Simulator(seed, monitorDelayChance);
-        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
-        return sim;
+        return new Simulator(seed, monitorDelayChance);
     }
 }
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ThreadSleepTest.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ThreadSleepTest.java
index 174762f..03bc348 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ThreadSleepTest.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ThreadSleepTest.java
@@ -23,6 +23,7 @@ import org.apache.cassandra.simulator.context.SharedTestState;
 import 
org.apache.cassandra.simulator.context.IIsolatedExecutor.SerializableRunnable;
 import org.apache.cassandra.simulator.step.ObservableAction;
 import org.apache.cassandra.simulator.step.Session;
+import 
org.apache.cassandra.simulator.systems.InstrumentedCassandraCountDownLatch;
 import org.apache.cassandra.utils.concurrent.CassandraCountDownLatch;
 import org.junit.jupiter.api.Test;
 
@@ -34,10 +35,17 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  */
 public class ThreadSleepTest extends StepApiTestSupport
 {
+    private static Simulator instrumentedSimulator(long seed)
+    {
+        Simulator sim = new Simulator(seed);
+        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
+        return sim;
+    }
+
     @Test
     void threadSleep_yieldsToWorkerDuringSleep()
     {
-        try (Simulator sim = simulator(42L);
+        try (Simulator sim = instrumentedSimulator(42L);
              Session session = sim.byStep((SerializableRunnable) () ->
         {
             var done = CassandraCountDownLatch.newCountDownLatch(2);
diff --git 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ThreadStartTest.java
 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ThreadStartTest.java
index 2e2017d..9246c9c 100644
--- 
a/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ThreadStartTest.java
+++ 
b/integration-test/src/test/java/org/apache/cassandra/simulator_test/step/ThreadStartTest.java
@@ -36,6 +36,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
  */
 public class ThreadStartTest extends StepApiTestSupport
 {
+    private static Simulator instrumentedSimulator(long seed)
+    {
+        Simulator sim = new Simulator(seed);
+        sim.intercept(CassandraCountDownLatch.class, 
InstrumentedCassandraCountDownLatch.class);
+        return sim;
+    }
+
     @Test
     void threadStart_workerBodyRunsInSeparateStep()
     {
@@ -59,7 +66,7 @@ public class ThreadStartTest extends StepApiTestSupport
     @Test
     void threadStart_withLatch_nothingHappensWithoutStep()
     {
-        try (Simulator sim = simulator(42L);
+        try (Simulator sim = instrumentedSimulator(42L);
              Session session = sim.byStep((SerializableRunnable) () -> {
             var done = CassandraCountDownLatch.newCountDownLatch(1);
 


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

Reply via email to