Commit graph

644 commits

Author SHA1 Message Date
5253ccc16e test: DeviceLive.Index health/response helpers and discovered-device validation 2026-05-09 12:34:17 -05:00
19d9ef9e52 test: Profiles.Base storage/printer/processor/Cambium branches 2026-05-09 12:29:23 -05:00
0f87ec5b89 test: Gaiia.Reconciliation nil-field mismatch suppression branch 2026-05-09 12:26:38 -05:00
d15d2cf29f test: DeviceLive.Show trigger_manual_backup success and disabled-mikrotik branches 2026-05-09 12:26:23 -05:00
bf2ad4031b test(agent_channel): cover stuck alert resolution, deprecated PING, MikroTik job building
Adds 8 tests targeting AgentChannel branches missed by existing tests:

- resolve_any_stuck_down_alerts: device_down and device_up stuck alerts
  resolved on next successful poll
- handle_in result with :PING job_type (deprecated SnmpResult path used
  by older agents) creates a monitoring check without crashing
- handle_live_poll_result with malformed job_id (missing reply_topic)
  hits the warning catch-all branch
- build_mikrotik_job is included in the initial dispatch when the device
  has a discovered SNMP profile whose manufacturer is MikroTik or whose
  sys_descr mentions RouterOS, and excluded when mikrotik_enabled is false
- process_additional_polling_data path with extra OIDs runs without
  crashing the channel
2026-05-09 12:25:13 -05:00
910298b6eb test: Profiles.Dynamic vendor post-processing + debug data branches 2026-05-09 12:23:02 -05:00
587e81bdad test: Gaiia.Actions API failure paths cover Logger.warning branches 2026-05-09 12:22:35 -05:00
3aed78282d test: TcpExecutor receive_timeout + Preseem.get_device_qoe_data
- Adds TcpExecutor receive timeout test using a server that accepts
  but never responds, exercising recv timeout branch
- Adds Preseem.get_device_qoe_data tests covering both no-APs and
  with-metrics paths through the AP query + metric formatting
2026-05-09 12:18:47 -05:00
c58b66d8ee test: CheckWorker recovery, dedupe, deleted-token branches 2026-05-09 12:18:32 -05:00
3dc9f3cf46 test: cover Admin OrgLive override / pricing event paths
Adds tests for edit_overrides patch, validate_overrides re-render,
save_overrides invalid + valid, clear_overrides, and delete_org
unknown-id paths.
2026-05-09 12:04:48 -05:00
fb288395aa test: GraphLive.Show error branches for missing sensor/storage/interface
Adds 4 tests that drive the nil → nil fallbacks in
load_single_sensor_chart_data, load_storage_chart_data,
load_interface_errors_chart_data, and load_interface_traffic_chart_data
by navigating to graph routes with non-existent IDs.
2026-05-09 11:58:48 -05:00
940b4daf14 test: cover MobileController format_equipment_details interface mapping
Adds direct call to MobileController.get_device with a snmp_device that
has interfaces — drives the Enum.map over interfaces in
format_equipment_details that previously had no fixture coverage.
2026-05-09 11:55:50 -05:00
1ae6c2b879 test: cover Splynx Client/Sync error branches
Adds:
- Splynx Client GET 403/429/unexpected/transport-error branches
- Splynx Client authenticate unexpected_status + transport_error
- Splynx Sync forbidden / unexpected_status / unparseable mrr / transport branches
2026-05-09 11:49:02 -05:00
38619f2b88 test: lift coverage to 87.14% via targeted branch tests
Adds tests across five files:
- Towerops.Monitoring.CheckQuery (full coverage of all composable filter
  fragments via inspect+Repo.all)
- ToweropsWeb.Admin.SecurityLive.Index change_filter event for both
  permanent and temporary filter values
- Towerops.Agents.AgentCache cleanup_expired handle_info path that
  prunes stale device entries while preserving :global_default
- ToweropsWeb.Api.V1.AgentReleaseWebhookController happy path
  (notified/skipped/version) and error path (Codeberg 503)
- ToweropsWeb.DeviceLive.Index reorder_device / reorder_site
  unauthorized branches via cross-org device/site fixtures
2026-05-09 11:44:25 -05:00
0c63cb608e test(coverage): exercise PingExecutor run_ping branches via loopback
Adds an untagged loopback test (127.0.0.1) so System.cmd /
Task.async / Task.yield branches in run_ping/3 are covered in CI
runs that exclude :network-tagged tests.
2026-05-09 11:31:46 -05:00
efd18facb1 test: OnCall change_schedule + change_escalation_policy default-arity helpers 2026-05-09 10:50:07 -05:00
8b71e21c04 test: Coverage schema statuses/0 + eirp_dbm + location helpers 2026-05-09 10:44:19 -05:00
1d5a5a8a73 test: GraphQL Device resolver update error/metrics/interfaces branches 2026-05-09 10:35:30 -05:00
8bc4f120c6 test: UserSettingsLive delete_api_token + revoke_session/mobile_device events 2026-05-09 10:27:53 -05:00
9ba80addf1 test: TotpManager create_device + verify + close_modal flows 2026-05-09 10:21:48 -05:00
b67f077547 test: HelpLive generate_password success/failure/transport-error branches 2026-05-09 10:17:51 -05:00
e39d1fb9e1 test: alert severity badges, maintenance form save success paths 2026-05-09 10:12:19 -05:00
16bbf07dd5 test: UserResetPasswordLive HIBP check_password_breach with value branch 2026-05-09 10:07:45 -05:00
84c839a218 test: IntegrationsLive test_connection across gaiia/sonar/splynx/visp branches 2026-05-09 10:02:15 -05:00
a224775fd3 test: EscalationPolicy resolver create/update validation error branches 2026-05-09 09:54:06 -05:00
33b18dea6f test: GraphQL Schedule resolver create/update/delete success and error branches 2026-05-09 09:50:08 -05:00
0c0d6e8691 test: UserSettingsLive password-breach + email/password error rerender paths 2026-05-09 09:45:35 -05:00
9c8f1d5506 test: WeatherSyncWorker fetch path with mocked OWM (success + 401 failure) 2026-05-09 09:41:07 -05:00
c9878d8479 test: cn_maestro/preseem client transport-error and forbidden branches 2026-05-09 09:37:10 -05:00
59483f3b81 test: AdminAuditLive export event triggers CSV download 2026-05-09 09:32:52 -05:00
5498dc6961 test: account activity request_path + data_accessed render branches 2026-05-09 09:28:18 -05:00
b51759dfdf test: cloud poller AgentChannel + SNMP sensor v3/no-snmp + firmware month parser 2026-05-09 09:20:27 -05:00
23a21a674d test: DeviceLive.Show compare_selected with 2 backups navigates to compare view 2026-05-09 09:12:53 -05:00
3606ba19b3 feat: ePMP firmware extraction + ePMP3000 NetSNMP-quirk detection
ePMP devices were not reporting firmware_version because the YAML's
cambiumCurrentuImageVersion.0 OID returns empty on ePMP3000 firmware.
Add detect_version/1 to the Epmp vendor module with two-OID fallback:
cambiumCurrentSWInfo.0 (verbose, ePMP3000-friendly) → cambiumCurrentuImageVersion.0
(short, ePMP1000/2000), with a regex to extract the version triplet
from whatever the device returns.

ePMP3000 also has a sysObjectID quirk where some firmware reports the
generic NetSNMP-on-Linux ID (.1.3.6.1.4.1.8072.3.2.10) instead of the
Cambium enterprise OID, causing devices to misclassify as the linux
profile. Add a second discovery block to the epmp profile that matches
NetSNMP-OID + PREEMPT_RT armv7l kernel signature + a confirming snmpget
against the Cambium ePMP MIB tree, so detection runs in pass-2
(conditional non-generic) before linux falls through in pass-3.
2026-05-09 08:34:23 -05:00
7519808e92 test: AlertLive sort_alerts impact branch + minor sweep 2026-05-08 18:27:06 -05:00
1c2b9efef7 test: sweep more branches in sync workers + Onboarding + Gaiia insights
- New `sync_worker_perform_test.exs` drives every cron sync worker's
  `perform/1` body via `Req.Test` stubs, exercising the {:error, _}
  branch of `sync_integration/1` for Sonar, Splynx, Visp, and NetBox,
  plus the should_sync?-skip path.
- OnboardingLive: covers `finish` event, `skip` from :agent (both
  trigger complete_onboarding), and `go_to_step :agent` (which calls
  the previously-untested `load_agent_token/1`).
- GaiiaInsightWorker: adds a test that drives `generate_mismatch_insights/2`
  by inserting an inventory item whose ip_address disagrees with its
  mapped device.

Coverage: 86.52% → 86.61%.
2026-05-08 18:21:49 -05:00
332ee37706 test: GraphLive live mode + Show snmp_sensor format + Alert/Activity events
Bumps coverage by exercising several previously-uncovered branches:

- GraphLive.Show: new test file driving `range=live` for every
  sensor_type (latency, processors, memory, traffic, temperature,
  storage, voltage, count, pppoe_sessions, connections, wireless,
  unknown), plus `get_title_suffix/1` across sensor_id / interface_id
  / storage_id, and `change_range` flipping into live mode.
- DeviceLive.Show: format_check_value/2 now covers the snmp_sensor
  branch across temperature, voltage, current, power, frequency,
  humidity, fanspeed (default + custom unit), and an unknown
  sensor_type with/without a configured unit.
- ActivityFeedLive: clear_search and load_more events; PubSub
  handle_info clauses for new_alert / alert_resolved / device_added
  / config_changed / sync_completed / device_event / :tick / catch-all.
- AlertLive.Index: acknowledge / resolve event handlers across
  success, not-found, and cross-org unauthorized branches.

Coverage: 86.42% → 86.52%.
2026-05-08 18:12:32 -05:00
fc20d60838 test: cover Topology role/link/evidence helper branches
Adds a dedicated test file that drives the small private mapping helpers
inside `Towerops.Topology` via their public surface:

- `role_to_type_atom/1`: every device_role string (router, core_router,
  switch, distribution_switch, access_switch, access_point, cpe,
  backhaul, backhaul_radio, server, firewall, ups, other, unknown
  fallback) is exercised through `device_to_node` (via
  `get_topology_for_map/2`) and again through `get_node_detail/2`.
- `link_type_priority/1`: each priority pair (lldp/cdp/mac_match/
  arp_inference) is exercised via `merge_bidirectional_edges/1` by
  upserting reciprocal links of differing types and asserting the
  higher-priority `link_type` survives the merge.
- `evidence_type_to_link_type/1`: every evidence_type clause
  (lldp_neighbor, cdp_neighbor, mac_on_interface, arp_entry,
  wireless_registration, plus the catch-all) is hit via
  `upsert_link/1` → `process_evidence_for_link/2`.

Coverage: 86.28% → 86.42% (+0.14%).
2026-05-08 17:57:47 -05:00
4ea64cb550 test: lift coverage from 85.84% → 86.28%
Adds focused tests across multiple modules to push toward the 87% threshold:

- CoreComponents: pagination/1 (multi-page, ellipsis, params),
  list/1 (slot rendering), and signal_badge/1 across all RSSI bands.
- ApiDocs/GraphQLDocs controllers: bypass-the-router pattern so the
  "scope-with-organization" branches are actually exercised (the public
  routes are unscoped, so the org branch is unreachable via get/2).
- Mix.Tasks.Unused: text + JSON output, --only / --skip filters.
- Mix.Tasks.JobCleanupTask: prod path with phoenix snmp enabled vs
  disabled (uses :job_cleanup_settle_ms = 0 to avoid the 1s sleep).
- Member resolver: success path for remove/update_role on non-owner
  membership, and the changeset-error branch for an invalid role.
- Check resolver: unauthenticated fallback clauses for list / get /
  create / update / delete.
- RfLinks: nil-signal sort ordering, :unknown classification for
  nil/nil signal+snr, :degraded filter, capacity_utilization edge
  cases (max_rate 0/missing, both rates nil).
- StatusHelpers: status_emoji + title_with_status across green / red
  branches (warning is unreachable given the active-alerts query).
- ApiTokens: spawn_async_update/2 path with env != :test.
- ImpactAnalysis: to_json/1 across nil and populated levels.
- Maintenance: query helpers (default-arity wrappers, active range)
  and Show LiveView delete event redirecting to /maintenance.
- Coverage map: probe_point event handler.
- InvitationQuery: default-arity pending/1.
2026-05-08 17:44:18 -05:00
c50dc08ad4 test: fix slow + flaky tests (Mox global, env pollution, pool starvation)
- Remove Mox.set_mox_global() in DPW extra test; rely on $callers
  instead so concurrent vendor SNMP tests stop intermittently failing
  with VerificationError.
- Make ToweropsWeb.Plugs.GraphQLIntrospectionTest async: false. It
  mutates Application.put_env(:towerops, :env, :prod), which polluted
  every async vendor test that reads :env via
  Towerops.Snmp.Client.phoenix_snmp_disabled/0.
- Bump test pool queue_target/queue_interval. AgentChannelTest spawns
  many `:proc_lib` channel processes that hold sandbox connections;
  the default 50ms queue caused intermittent
  'could not checkout the connection' errors.
- Tag real-System.cmd("ping") tests as :network so they're excluded
  by default. Saves ~20s on every full run.
- Make JobCleanupTask's internal 1s settle sleep configurable via
  :job_cleanup_settle_ms; the test overrides it to 0.

Plus the pending CoverageLive.Form edit-save / EIRP recompute and
TraceLive deep-link tests from before the compact.
2026-05-08 14:43:30 -05:00
c90e34de0b test: DashboardLive acknowledge_alert success and cross-org branches 2026-05-08 14:04:20 -05:00
bcb7882d34 test: redis password branches + suppress 0.0 pattern warnings + coverages from() macro fix 2026-05-08 13:57:07 -05:00
749fc27a80 test: Airfiber detect_version + OnCall.Escalation start_escalation no-policy branches 2026-05-08 13:51:55 -05:00
1b35177c1b test: GaiiaReconciliationLive + ActivityFeedLive helpers and events 2026-05-08 13:39:01 -05:00
76de672ac8 test: parametric HelpLive section coverage + MibCache init/pre_resolve 2026-05-08 13:30:38 -05:00
5af987035f test: GlobalSearch keyboard nav + StatusPageLive mount + Coverages.Profile clutter polygons 2026-05-08 13:23:13 -05:00
09e9fd2f3b test: SiteLive force_rediscover + CoverageLive.Show coverage_status broadcast 2026-05-08 13:16:13 -05:00
67bb67c722 test: GraphQL.Resolvers.Agent direct unit tests 2026-05-08 13:11:02 -05:00
91b0cac164 test: GraphQL.Resolvers.EscalationPolicy + MobileController list_alerts formatting 2026-05-08 13:00:56 -05:00
f8af326deb test: ReportsLive toggle/delete/run_now + UserRegistration invitation paths + SiteLive geocode/apply 2026-05-08 12:53:06 -05:00