Fix flaky tests in MonitoringSupervisor and AlertNotifier

- Add Mox stub setup in supervisor_test.exs to handle DeviceMonitor ping calls
- Change alert_notifier_test.exs to async: true to prevent mailbox contamination
- All 1066 tests now passing with 0 failures
This commit is contained in:
Graham McIntire 2026-01-20 13:48:13 -06:00
parent 1dbcbb92f1
commit f9553b1444
No known key found for this signature in database
2 changed files with 8 additions and 1 deletions

View file

@ -1,5 +1,5 @@
defmodule Towerops.Alerts.AlertNotifierTest do
use Towerops.DataCase, async: false
use Towerops.DataCase, async: true
import Swoosh.TestAssertions
import Towerops.AccountsFixtures

View file

@ -1,12 +1,19 @@
defmodule Towerops.Monitoring.SupervisorTest do
use Towerops.DataCase, async: false
import Mox
import Towerops.AccountsFixtures
alias Towerops.Monitoring.PingMock
alias Towerops.Monitoring.Supervisor, as: MonitoringSupervisor
alias Towerops.Snmp.PollerRegistry
setup :verify_on_exit!
setup do
# Stub ping calls for any monitors that start during tests
# Allow any number of ping calls (monitors ping on init)
stub_with(PingMock, Towerops.Monitoring.PingStub)
# Start Monitoring.Supervisor for these tests
start_supervised!(MonitoringSupervisor)