11defmodule ColouredFlow.Runner.EnactmentTest do
2- use ColouredFlow.RepoCase
2+ use ColouredFlow.RepoCase , async: true
33 use ColouredFlow.RunnerHelpers
44
55 alias ColouredFlow.Enactment.BindingElement
@@ -304,6 +304,7 @@ defmodule ColouredFlow.Runner.EnactmentTest do
304304
305305 test "coalesces a burst of :take_snapshot messages into fewer storage writes" ,
306306 % { enactment: enactment } do
307+ enactment_id = enactment . id
307308 [ enactment_server: enactment_server ] = start_enactment ( % { enactment: enactment } )
308309
309310 # Wait until the boot-time snapshot from `handle_continue` has been emitted
@@ -317,8 +318,12 @@ defmodule ColouredFlow.Runner.EnactmentTest do
317318 :telemetry . attach (
318319 handler_id ,
319320 [ :coloured_flow , :runner , :enactment , :take_snapshot ] ,
320- fn _event , _measurements , _metadata , _config ->
321- send ( self_pid , :snapshot_taken )
321+ fn _event , _measurements , metadata , _config ->
322+ # Filter by enactment_id so concurrent async tests don't pollute
323+ # this test's measurement.
324+ if metadata . enactment_id == enactment_id do
325+ send ( self_pid , :snapshot_taken )
326+ end
322327 end ,
323328 nil
324329 )
0 commit comments