fix: increase timeout in flaky debounce test (#210)

The test was using 75ms timeout which was too tight:
- 5 broadcasts with 5ms delays = 25ms
- Debounce delay = 50ms
- Processing overhead = variable

Increased to 200ms to match other similar tests in the file and provide
adequate buffer for debouncing + processing.

Also reformatted proto erlang_compat files to fix line length issues.

Reviewed-on: graham/towerops-web#210
This commit is contained in:
Graham McIntire 2026-03-28 15:57:19 -05:00
parent 7c1c4a0c63
commit f326808d15
3 changed files with 27 additions and 9 deletions

View file

@ -141,10 +141,24 @@ defmodule :towerops@proto@decode do
end
defp metric_to_gleam({:neighbor_discovery, %Types.NeighborDiscovery{} = nd}) do
{:neighbor_discovery_metric,
{:neighbor_discovery, nd.interface_id, nd.protocol, nd.remote_chassis_id, nd.remote_system_name,
nd.remote_system_description, nd.remote_platform, nd.remote_port_id, nd.remote_port_description, nd.remote_address,
nd.remote_capabilities, nd.timestamp}}
{
:neighbor_discovery_metric,
{
:neighbor_discovery,
nd.interface_id,
nd.protocol,
nd.remote_chassis_id,
nd.remote_system_name,
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
nd.remote_system_description,
nd.remote_platform,
nd.remote_port_id,
nd.remote_port_description,
nd.remote_address,
nd.remote_capabilities,
nd.timestamp
}
}
end
# Stub implementations for less critical functions

View file

@ -447,9 +447,12 @@ defmodule :towerops@proto@encode do
:none ->
nil
{:some,
{:snmp_device, ip, community, version, port, v3_security_level, v3_username, v3_auth_protocol, v3_auth_password,
v3_priv_protocol, v3_priv_password, transport}} ->
{
:some,
# credo:disable-for-next-line Credo.Check.Readability.MaxLineLength
{:snmp_device, ip, community, version, port, v3_security_level, v3_username, v3_auth_protocol, v3_auth_password,
v3_priv_protocol, v3_priv_password, transport}
} ->
%Types.SnmpDevice{
ip: ip,
community: community,

View file

@ -1538,10 +1538,11 @@ defmodule ToweropsWeb.AgentChannelTest do
end
# Should only receive ONE jobs message (debounced) - 50ms debounce in test
assert_push "jobs", %{binary: _jobs_binary}, 75
# Use 200ms timeout to account for debounce delay + processing time
assert_push "jobs", %{binary: _jobs_binary}, 200
# Should NOT receive additional jobs messages
refute_push "jobs", _, 50
refute_push "jobs", _, 100
end
end
end