From a6813dbb4e07c2934760673dd39e0c09594ed427 Mon Sep 17 00:00:00 2001 From: Niels Mokkenstorm Date: Mon, 20 Jul 2026 16:11:22 +0200 Subject: [PATCH] test(server): make unreachable stubs actually unreachable --- server/test/actor_shelf_test.gleam | 6 ++++-- server/test/discogs_scan_test.gleam | 6 ++++-- server/test/edit_inbox_test.gleam | 2 +- server/test/support.gleam | 2 +- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/server/test/actor_shelf_test.gleam b/server/test/actor_shelf_test.gleam index f89a475..caef85a 100644 --- a/server/test/actor_shelf_test.gleam +++ b/server/test/actor_shelf_test.gleam @@ -129,7 +129,9 @@ fn network_client(records_body: String) -> xrpc.Client { } fn failing_resolver_client() -> xrpc.Client { - xrpc.Client(send: fn(_req) { Error(core_xrpc.Other("resolver unreachable")) }) + xrpc.Client(send: fn(_req) { + Error(core_xrpc.ConnectionFailed("resolver unreachable")) + }) } fn pds_unreachable_client() -> xrpc.Client { @@ -137,7 +139,7 @@ fn pds_unreachable_client() -> xrpc.Client { case req.host { "resolver.test" -> Ok(response.Response(200, [], bit_array.from_string(resolve_body()))) - _ -> Error(core_xrpc.Other("pds unreachable")) + _ -> Error(core_xrpc.ConnectionFailed("pds unreachable")) } }) } diff --git a/server/test/discogs_scan_test.gleam b/server/test/discogs_scan_test.gleam index a953ddc..2101340 100644 --- a/server/test/discogs_scan_test.gleam +++ b/server/test/discogs_scan_test.gleam @@ -67,7 +67,7 @@ fn mb_returns_exact_match() -> xrpc.Client { fn mb_fails() -> xrpc.Client { xrpc.Client(send: fn(_req) { - Error(core_xrpc.Other("musicbrainz unreachable")) + Error(core_xrpc.ConnectionFailed("musicbrainz unreachable")) }) } @@ -216,7 +216,9 @@ pub fn network_miss_falls_through_to_the_discogs_chain_test() { pub fn network_stage_failure_falls_through_to_discogs_test() { let failing_client = - xrpc.Client(send: fn(_req) { Error(core_xrpc.Other("unreachable")) }) + xrpc.Client(send: fn(_req) { + Error(core_xrpc.ConnectionFailed("unreachable")) + }) let #(ctx, cfg) = test_context_with_users(failing_client, discogs_always_misses, [ a_known_user(), diff --git a/server/test/edit_inbox_test.gleam b/server/test/edit_inbox_test.gleam index 7c97e6a..dc08043 100644 --- a/server/test/edit_inbox_test.gleam +++ b/server/test/edit_inbox_test.gleam @@ -27,7 +27,7 @@ fn session() -> OauthSession { /// A client whose every request fails, so `handle_resolver.resolve_handle` /// degrades to `None` without needing a live PLC directory. fn no_network_client() -> xrpc.Client { - xrpc.Client(send: fn(_req) { Error(core_xrpc.Other("offline")) }) + xrpc.Client(send: fn(_req) { Error(core_xrpc.ConnectionFailed("offline")) }) } /// [1, 2, .., count] diff --git a/server/test/support.gleam b/server/test/support.gleam index 1a99396..7021026 100644 --- a/server/test/support.gleam +++ b/server/test/support.gleam @@ -34,7 +34,7 @@ pub fn xrpc(rest: String) -> String { } pub fn unreachable_client() -> xrpc.Client { - xrpc.Client(send: fn(_req) { Error(core_xrpc.Other("unused")) }) + xrpc.Client(send: fn(_req) { Error(core_xrpc.ConnectionFailed("unused")) }) } pub fn unreachable_catalog_deps() -> catalog_deps.Deps { -- 2.51.2