mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
5ef7480a01
commit
cdf9567561
@@ -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<String>,
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user