aprs.me/test/test_helper.exs
Graham McIntire b0832e5a9c
Some checks failed
Build and Push / Build and Push Docker Image (push) Failing after 2s
refactor: harden packet delivery and operations
2026-07-26 13:11:26 -05:00

30 lines
960 B
Elixir

# Reduce parallelism when coverage is enabled to prevent file descriptor exhaustion
max_cases =
if System.get_env("MIX_TEST_COVERAGE") do
2
else
System.schedulers_online() * 4
end
ExUnit.start(
max_cases: max_cases,
timeout: 30_000,
capture_log: true,
exclude: [:integration]
)
Ecto.Adapters.SQL.Sandbox.mode(Aprsme.Repo, :manual)
# Configure Mox
Mox.defmock(Aprsme.PacketsMock, for: Aprsme.PacketsBehaviour)
Mox.defmock(PacketsMock, for: Aprsme.PacketsBehaviour)
# Set up default stubs for commonly used functions
Mox.stub(Aprsme.PacketsMock, :get_recent_packets, fn _opts -> [] end)
Mox.stub(Aprsme.PacketsMock, :get_nearby_stations, fn _lat, _lon, _exclude, _opts -> [] end)
# Ensure no external APRS connections during tests
Application.put_env(:aprsme, :aprs_is_server, "mock.aprs.test")
Application.put_env(:aprsme, :packets_module, Aprsme.PacketsMock)
# AprsIsMock is automatically loaded from test/support via elixirc_paths