From 7e2fa438f7d68a038d623a40083485d6e903d77c Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 5 May 2026 12:46:23 -0500 Subject: [PATCH] test: widen timeout margins in DeferredDiscoveryTest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each timeout test was sleeping 55ms vs a 50ms timeout — flaky on slow CI runners where the sleep occasionally finishes before the timer fires. Bumps every flaky timing pair to 500ms sleep / 25ms timeout so the timeout always wins. --- .../towerops/snmp/deferred_discovery_test.exs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/towerops/snmp/deferred_discovery_test.exs b/test/towerops/snmp/deferred_discovery_test.exs index b18ab492..08b3b08f 100644 --- a/test/towerops/snmp/deferred_discovery_test.exs +++ b/test/towerops/snmp/deferred_discovery_test.exs @@ -27,10 +27,10 @@ defmodule Towerops.Snmp.DeferredDiscoveryTest do DeferredDiscovery.fast_check( client_opts, fn -> - Process.sleep(55) + Process.sleep(500) {:ok, "too slow"} end, - timeout: 50 + timeout: 25 ) assert result == {:error, :timeout} @@ -67,10 +67,10 @@ defmodule Towerops.Snmp.DeferredDiscoveryTest do DeferredDiscovery.slow_check( client_opts, fn -> - Process.sleep(55) + Process.sleep(500) {:ok, "too slow"} end, - timeout: 50, + timeout: 25, default: [] ) @@ -84,10 +84,10 @@ defmodule Towerops.Snmp.DeferredDiscoveryTest do DeferredDiscovery.slow_check( client_opts, fn -> - Process.sleep(55) + Process.sleep(500) {:ok, "too slow"} end, - timeout: 50, + timeout: 25, default: %{status: :timeout} ) @@ -129,10 +129,10 @@ defmodule Towerops.Snmp.DeferredDiscoveryTest do DeferredDiscovery.deferred_check( client_opts, fn -> - Process.sleep(55) + Process.sleep(500) {:ok, "too slow"} end, - timeout: 50, + timeout: 25, name: "neighbors" ) @@ -227,13 +227,13 @@ defmodule Towerops.Snmp.DeferredDiscoveryTest do test "returns false when check times out" do expect(SnmpMock, :get, fn _target, _oid, _opts -> - Process.sleep(55) + Process.sleep(500) {:ok, [1, 3, 6, 1, 4, 1, 9]} end) client_opts = [ip: "192.168.1.1", community: "public", version: "2c"] - assert DeferredDiscovery.device_responsive?(client_opts, timeout: 50) == false + assert DeferredDiscovery.device_responsive?(client_opts, timeout: 25) == false end end