test: fix async-hydration timeout flake + type warning

- Bump render_async/2 timeout to 2_000ms across contact_live_test.
  Default 100ms races when the suite runs on a loaded box — ContactLive.
  Show fans out 8 hydration tasks at mount and sporadically missed the
  window even on a quiet DB.
- Telemetry metrics-shape assertion uses Enum.any?/1 instead of the
  `metrics != []` comparison Elixir 1.19's type system flags as a
  distinct-type comparison (the function's non-empty return type).
This commit is contained in:
Graham McIntire 2026-04-24 09:28:52 -05:00
parent b2b8ddc1c4
commit 1e8dd7036d
No known key found for this signature in database
GPG key ID: F4ABF488E6029E59
2 changed files with 10 additions and 10 deletions

View file

@ -383,7 +383,7 @@ defmodule MicrowavepropWeb.ContactLiveTest do
{:ok, lv, _html} = live(conn, ~p"/contacts/#{contact.id}")
html = render_async(lv)
html = render_async(lv, 2_000)
assert html =~ "Atmospheric Profile"
assert html =~ "NARR"
# Collapsed summary shows HPBL / PWAT / lat,lon from the injected NARR row.
@ -441,7 +441,7 @@ defmodule MicrowavepropWeb.ContactLiveTest do
|> Repo.insert()
{:ok, lv, _html} = live(conn, ~p"/contacts/#{contact.id}")
html = render_async(lv)
html = render_async(lv, 2_000)
assert html =~ "HRRR native"
# 300 mb comes from the native profile — pressure-level data capped at 700.
@ -719,7 +719,7 @@ defmodule MicrowavepropWeb.ContactLiveTest do
{:ok, lv, _html} = live(conn, ~p"/contacts/#{contact.id}")
html = render_async(lv)
html = render_async(lv, 2_000)
# Surface Observations section is present; actual rows may or may
# not render depending on internal proximity/time filters. The
# render pass itself exercises the with-data code path either way.
@ -758,7 +758,7 @@ defmodule MicrowavepropWeb.ContactLiveTest do
{:ok, lv, _html} = live(conn, ~p"/contacts/#{contact.id}")
html = render_async(lv)
html = render_async(lv, 2_000)
assert html =~ "KFWD"
end
@ -915,7 +915,7 @@ defmodule MicrowavepropWeb.ContactLiveTest do
contact = seed_fully_hydrated()
{:ok, lv, _html} = live(conn, ~p"/contacts/#{contact.id}")
html = render_async(lv)
html = render_async(lv, 2_000)
# Headers / enrichment labels visible when data is present.
assert html =~ contact.station1
@ -932,7 +932,7 @@ defmodule MicrowavepropWeb.ContactLiveTest do
contact = seed_fully_hydrated()
{:ok, lv, _html} = live(conn, ~p"/contacts/#{contact.id}")
_ = render_async(lv)
_ = render_async(lv, 2_000)
# Simulate the TerrainProfileWorker broadcast — the listener
# recomputes elevation_profile and propagation_analysis and
@ -946,7 +946,7 @@ defmodule MicrowavepropWeb.ContactLiveTest do
contact = seed_fully_hydrated()
{:ok, lv, _html} = live(conn, ~p"/contacts/#{contact.id}")
_ = render_async(lv)
_ = render_async(lv, 2_000)
send(lv.pid, {:terrain_ready, Ecto.UUID.generate()})
assert Process.alive?(lv.pid)
@ -956,7 +956,7 @@ defmodule MicrowavepropWeb.ContactLiveTest do
contact = seed_fully_hydrated()
{:ok, lv, _html} = live(conn, ~p"/contacts/#{contact.id}")
_ = render_async(lv)
_ = render_async(lv, 2_000)
send(lv.pid, {:sounding_fetched, %{contact_id: contact.id}})
html = render(lv)
@ -967,7 +967,7 @@ defmodule MicrowavepropWeb.ContactLiveTest do
contact = seed_fully_hydrated()
{:ok, lv, _html} = live(conn, ~p"/contacts/#{contact.id}")
_ = render_async(lv)
_ = render_async(lv, 2_000)
send(lv.pid, {:sounding_fetched, %{contact_id: Ecto.UUID.generate()}})
assert Process.alive?(lv.pid)

View file

@ -9,7 +9,7 @@ defmodule MicrowavepropWeb.TelemetryTest do
metrics = Telemetry.metrics()
assert is_list(metrics)
assert metrics != []
assert Enum.any?(metrics)
for m <- metrics do
assert is_struct(m)