Fix flaky deferred_discovery timeout test — use receive instead of Process.sleep for deterministic blocking

This commit is contained in:
Graham McIntire 2026-06-16 16:26:11 -05:00
parent a4e08b2aca
commit bdf22cd411

View file

@ -67,8 +67,9 @@ defmodule Towerops.Snmp.DeferredDiscoveryTest do
DeferredDiscovery.slow_check(
client_opts,
fn ->
Process.sleep(30)
{:ok, "too slow"}
receive do
:never -> {:ok, "too slow"}
end
end,
timeout: 25,
default: []
@ -84,8 +85,9 @@ defmodule Towerops.Snmp.DeferredDiscoveryTest do
DeferredDiscovery.slow_check(
client_opts,
fn ->
Process.sleep(30)
{:ok, "too slow"}
receive do
:never -> {:ok, "too slow"}
end
end,
timeout: 25,
default: %{status: :timeout}