aprs.me/test/aprsme_web/telemetry_test.exs
Graham McIntire 281aef095c
fix: resolve all credo warnings and pre-existing dialyzer errors
- Move require Logger to module top level in SpatialPubSub
- Replace weak is_list assertions with stronger checks
- Remove redundant 'is a list' test in PromEx tests
- Replace apply/3 with direct function call in packet_replay test
- Fix unmatched_return in weather_cache.ex and callsign_view.ex
2026-07-17 16:41:15 -05:00

40 lines
1.3 KiB
Elixir

defmodule AprsmeWeb.TelemetryTest do
use ExUnit.Case, async: true
alias AprsmeWeb.Telemetry
describe "metrics/0" do
test "returns a non-empty list of metric definitions" do
metrics = Telemetry.metrics()
refute Enum.empty?(metrics)
end
test "includes Phoenix endpoint, router, and live_view metrics" do
names =
Telemetry.metrics()
|> Enum.map(& &1.name)
|> Enum.map(&Enum.join(&1, "."))
assert Enum.any?(names, &String.starts_with?(&1, "phoenix.endpoint"))
assert Enum.any?(names, &String.starts_with?(&1, "phoenix.router_dispatch"))
end
test "includes Postgres metrics for connections, packets_table and replication" do
names =
Telemetry.metrics()
|> Enum.map(& &1.name)
|> Enum.map(&Enum.join(&1, "."))
assert Enum.any?(names, &String.contains?(&1, "aprsme.postgres.connections"))
assert Enum.any?(names, &String.contains?(&1, "aprsme.postgres.packets_table"))
assert Enum.any?(names, &String.contains?(&1, "aprsme.postgres.replication"))
end
test "every metric has a defined name and event_name" do
Enum.each(Telemetry.metrics(), fn m ->
assert m.name != []
assert m.event_name != []
end)
end
end
end