test: expand agent channel coverage from 8% to 66%

add 54 tests covering join/terminate lifecycle, heartbeat, error,
credential_test_result, monitoring_check, mikrotik_result, catch-all
handle_in events, handle_info lifecycle messages, PubSub messages,
SNMP result edge cases, poll result sensor/interface data storage,
SNMPv3 credential paths, and monitoring-enabled device job building.

fix bug where error.error_message was used instead of error.message
matching the AgentError protobuf struct field name.
This commit is contained in:
Graham McIntire 2026-02-11 16:52:12 -06:00
parent a1efba0b0e
commit f00dc3ff12
No known key found for this signature in database
2 changed files with 988 additions and 2 deletions

View file

@ -456,14 +456,14 @@ defmodule ToweropsWeb.AgentChannel do
{:ok, error} <- Validator.validate_agent_error(binary) do
maybe_debug_log(socket, "Agent job error",
device_id: error.device_id,
error_message: error.error_message,
error_message: error.message,
binary_size: byte_size(binary_b64)
)
Logger.error("Agent job error",
agent_token_id: socket.assigns.agent_token_id,
device_id: error.device_id,
error: error.error_message
error: error.message
)
{:noreply, socket}

File diff suppressed because it is too large Load diff