From cdf95675611a191063d9a5aee54e2890803d3ba4 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 18 Sep 2026 14:36:07 +0000 Subject: [PATCH] test(common): let TestRelay configure archive GRASP services The archive service tests run their own copy of the relay spawn logic because TestRelay had no way to set NGIT_ARCHIVE_GRASP_SERVICES. Add the option to RelayOptions, pass it through to the subprocess environment, and expose `start_with_archive_grasp_services` so those tests can use the shared fixture, including its bound-listener handoff. No existing constructor changes behaviour; the option defaults to unset. Validation: `cargo test -p ngit-grasp --test archive_grasp_services --no-run` builds; the constructor is exercised by the next commit. Assisted-by: Claude Fable 5.1 Co-Authored-By: Claude Fable 5.1 --- tests/common/relay.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/common/relay.rs b/tests/common/relay.rs index dbe4d12..5b55ac0 100644 --- a/tests/common/relay.rs +++ b/tests/common/relay.rs @@ -71,6 +71,9 @@ struct RelayOptions { disable_negentropy: bool, archive_all: bool, archive_read_only: bool, + /// Comma-separated GRASP service domains whose repositories this relay + /// archives (`NGIT_ARCHIVE_GRASP_SERVICES`). + archive_grasp_services: Option, grasp06_enable: bool, deletion_request_disrespector: bool, lmdb_backend: bool, @@ -406,6 +409,19 @@ impl TestRelay { /// means to attribute to the relay under test alone. The production /// policy rejects non-global event-directed targets, so the source stays /// scenery. Its own hosting, admission, and serving behavior is unchanged. + /// Start a relay that archives repositories hosted on the given + /// comma-separated GRASP service domains. + pub async fn start_with_archive_grasp_services(services: &str) -> Self { + Self::start_internal( + port::reserve_port(), + RelayOptions { + archive_grasp_services: Some(services.to_string()), + ..RelayOptions::default() + }, + ) + .await + } + pub async fn start_archive_source_behind_proxy() -> Self { Self::start_internal( port::reserve_port(), @@ -880,6 +896,9 @@ impl TestRelay { if options.archive_read_only { cmd.env("NGIT_ARCHIVE_READ_ONLY", "true"); } + if let Some(services) = &options.archive_grasp_services { + cmd.env("NGIT_ARCHIVE_GRASP_SERVICES", services); + } // Enable GRASP-06 if requested. If the binary does not yet recognise // this env var (pre-implementation), clap simply ignores it.