@@ -241,29 +241,28 @@ defmodule ActorSimulationTest do
241241 test "simulates long durations much faster than real time" do
242242 start_time = System . monotonic_time ( :millisecond )
243243
244- # Simulate 1 minute of a high-frequency system
244+ # Simulate 10 seconds at 10 messages/second (more reasonable for CI)
245245 simulation =
246246 ActorSimulation . new ( )
247247 |> ActorSimulation . add_actor ( :high_freq_producer ,
248- # 100 messages/second
249- send_pattern: { :rate , 100 , :tick } ,
248+ # 10 messages/second
249+ send_pattern: { :rate , 10 , :tick } ,
250250 targets: [ :consumer ]
251251 )
252252 |> ActorSimulation . add_actor ( :consumer )
253- # 1 minute
254- |> ActorSimulation . run ( duration: 60_000 )
253+ # 10 seconds
254+ |> ActorSimulation . run ( duration: 10_000 )
255255
256256 elapsed = System . monotonic_time ( :millisecond ) - start_time
257257 stats = ActorSimulation . get_stats ( simulation )
258258
259- # Should have sent ~6,000 messages (100 /sec * 60 sec)
259+ # Should have sent ~100 messages (10 /sec * 10 sec)
260260 # Allow some variance due to timing
261- assert stats . actors [ :high_freq_producer ] . sent_count >= 5_900
262- assert stats . actors [ :consumer ] . received_count >= 5_900
261+ assert stats . actors [ :high_freq_producer ] . sent_count >= 95
262+ assert stats . actors [ :consumer ] . received_count >= 95
263263
264- # But the test completes much faster than real time (60 seconds)
265- # Be generous with the assertion to avoid flakiness on slower machines
266- assert elapsed < 60_000 , "Should complete faster than the 60 seconds of real time simulated"
264+ # But the test completes much faster than real time (10 seconds)
265+ assert elapsed < 10_000 , "Should complete faster than the 10 seconds of real time simulated"
267266
268267 ActorSimulation . stop ( simulation )
269268 end
0 commit comments