test: widen timeout margins in DeferredDiscoveryTest
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.
This commit is contained in:
parent
79d7848df9
commit
7e2fa438f7
1 changed files with 10 additions and 10 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue