Skip to content

Commit c6bd90a

Browse files
committed
Synchronize handler timeout test startup
1 parent 2b97e97 commit c6bd90a

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎test/vm/runtime/async_test.exs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,14 @@ defmodule QuickBEAM.VM.Runtime.AsyncTest do
114114
Process.sleep(:infinity)
115115
end
116116

117-
assert {:error, {:limit_exceeded, :timeout, 1_000}} =
118-
QuickBEAM.VM.eval(program, handlers: %{"wait" => handler}, timeout: 1_000)
117+
evaluation =
118+
Task.async(fn ->
119+
QuickBEAM.VM.eval(program, handlers: %{"wait" => handler}, timeout: 1_000)
120+
end)
119121

120122
assert_receive {:handler_started, handler_pid}, 1_000
123+
124+
assert {:error, {:limit_exceeded, :timeout, 1_000}} = Task.await(evaluation, 2_000)
121125
monitor = Process.monitor(handler_pid)
122126
assert_receive {:DOWN, ^monitor, :process, ^handler_pid, _reason}, 1_000
123127
end

0 commit comments

Comments
 (0)