From 09e65462f53e298708ebbea0c8d1bd287a64e1ae Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Tue, 4 Aug 2026 17:56:20 -0500 Subject: [PATCH] fix: wire HrdpsClient into Req.Test plug pipeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit HrdpsClient already calls Req.get/head with req_options() that merge :hrdps_req_options from config. Add plug: {Req.Test, HrdpsClient} to test config so Req.Test.stub intercepts HTTP calls — same pattern as HrrrClient. Also add hrdps_cycle_available_fn default so the HTTP probe doesn't fire in tests. Replace the env-based Application.put_env stubs in DataCase with Req.Test.stub(HrdpsClient, 404). --- config/test.exs | 2 ++ test/support/data_case.ex | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/config/test.exs b/config/test.exs index 131deeb7..010ba986 100644 --- a/config/test.exs +++ b/config/test.exs @@ -95,6 +95,8 @@ config :microwaveprop, cache_contact_map: false config :microwaveprop, elevation_req_options: [plug: {Req.Test, Microwaveprop.Terrain.ElevationClient}, retry: false] config :microwaveprop, gefs_req_options: [plug: {Req.Test, Microwaveprop.Weather.GefsClient}, retry: false] config :microwaveprop, giro_req_options: [plug: {Req.Test, Microwaveprop.Ionosphere.GiroClient}, retry: false] +config :microwaveprop, hrdps_cycle_available_fn: fn _run_time -> true end +config :microwaveprop, hrdps_req_options: [plug: {Req.Test, Microwaveprop.Weather.HrdpsClient}, retry: false] # Default the HRRR cycle freshness probe to "always available" in tests. # Individual cases that exercise the fallback path override via diff --git a/test/support/data_case.ex b/test/support/data_case.ex index bbbf7bc4..f1f0cfad 100644 --- a/test/support/data_case.ex +++ b/test/support/data_case.ex @@ -58,6 +58,10 @@ defmodule Microwaveprop.DataCase do Plug.Conn.send_resp(conn, 404, "not found") end) + Req.Test.stub(Microwaveprop.Weather.HrdpsClient, fn conn -> + Plug.Conn.send_resp(conn, 404, "not found") + end) + :ok end