maedhroz commented on code in PR #4659:
URL: https://github.com/apache/cassandra/pull/4659#discussion_r2897258705
##########
test/simulator/test/org/apache/cassandra/simulator/test/SimulationTestBase.java:
##########
@@ -325,43 +338,69 @@ T create(SimulatedSystems simulated,
RunnableActionScheduler scheduler, Cluster
public static <T extends Simulation> void simulate(LongSupplier seedGen,
ClusterSimulation.Builder<T> factory,
Consumer<ClusterSimulation.Builder<T>> configure) throws IOException
+ {
+ simulate(seedGen, factory, configure, 1);
+ }
+
+ public static <T extends Simulation> void simulate(LongSupplier seedGen,
+
ClusterSimulation.Builder<T> factory,
+
Consumer<ClusterSimulation.Builder<T>> configure,
+ int iterations) throws
IOException
{
SimulationRunner.beforeAll();
long seed = seedGen.getAsLong();
// Development seed:
//long seed = 1687184561194L;
System.out.printf("Simulation seed: %dL%n", seed);
configure.accept(factory);
- try (ClusterSimulation<?> cluster = factory.create(seed))
+ for (int i = 0; i < iterations; i++)
{
- try (Simulation simulation = cluster.simulation())
- {
- simulation.run();
- }
- catch (Throwable t)
+ long currentSeed = seed + i;
+ System.out.printf("Running iteration %d of %d with seed %dL%n", i
+ 1, iterations, currentSeed);
+ try (ClusterSimulation<?> cluster = factory.create(currentSeed))
{
- throw new SimulationException(seed, t);
+ try (Simulation simulation = cluster.simulation())
+ {
+ simulation.run();
+ }
+ catch (Throwable t)
+ {
+ throw new SimulationException(currentSeed, t);
+ }
}
}
- catch (Throwable t)
- {
- if (t instanceof SimulationException)
- throw t;
- throw new SimulationException(seed, t);
- }
Review Comment:
I think we need to retain this `catch` block. It handles errors from `try
(ClusterSimulation<?> cluster = factory.create(currentSeed))` right?
--
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]