From bd371b17a4f50e2cc3cfcfd748fc3e1792da43a1 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Sat, 15 Aug 2026 14:38:55 +0000 Subject: [PATCH] test(logging): opt ordering fixtures into debug logs Maintainer-reprocessing integration tests use the rejected event ID in the relay log as an observable barrier before they mutate reciprocal repository state. Demoting per-event rejection diagnostics to debug made those barriers invisible at the production info default. Add an explicit debug-level TestRelay option and enable it only for fixtures that observe rejection diagnostics. The ordinary fixture retains the production info default, while short-hot-cache fixtures select debug because all current callers rely on that barrier. This deliberately preserves the existing bounded log wait instead of adding sleeps or changing production severity. Tests that do not inspect debug diagnostics remain unchanged. Validated with cargo fmt --check, git diff --check, and all nine maintainer-reprocessing integration tests running sequentially. --- tests/common/relay.rs | 25 +++++++++++++++++++++++++ tests/sync/maintainer_reprocessing.rs | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/common/relay.rs b/tests/common/relay.rs index 3ecfca6..7ed8f6f 100644 --- a/tests/common/relay.rs +++ b/tests/common/relay.rs @@ -91,6 +91,9 @@ struct RelayOptions { relay_data_path: Option, deletion_lifecycle: Option, rejected_hot_cache_duration_secs: Option, + /// Application log level for tests that observe a diagnostic as an + /// ordering barrier. Other fixtures retain the production `info` default. + log_level: Option, relay_max_subscriptions: Option, sync_recursive_descendant_limit: Option, private_members: Option, @@ -182,6 +185,23 @@ impl TestRelay { .await } + /// Start a syncing relay with application debug diagnostics enabled. + /// + /// Most integration tests use the production `info` default. This focused + /// fixture supports tests that wait on a debug record as an observable + /// ordering condition before changing remote state. + pub async fn start_with_sync_debug(bootstrap_relay_url: Option) -> Self { + Self::start_internal( + port::reserve_port(), + RelayOptions { + bootstrap_relay_url, + log_level: Some("debug".to_string()), + ..RelayOptions::default() + }, + ) + .await + } + /// Start a syncing relay with a caller-chosen relay-owner identity. /// /// Lets tests stage owner-signed events on other relays before this @@ -263,6 +283,7 @@ impl TestRelay { RelayOptions { bootstrap_relay_url, rejected_hot_cache_duration_secs: Some(rejected_hot_cache_duration_secs), + log_level: Some("debug".to_string()), ..RelayOptions::default() }, ) @@ -764,6 +785,10 @@ impl TestRelay { ); } + if let Some(log_level) = &options.log_level { + cmd.env("NGIT_LOG_LEVEL", log_level); + } + if let Some(limit) = options.relay_max_subscriptions { cmd.env("NGIT_RELAY_MAX_SUBSCRIPTIONS", limit.to_string()); } diff --git a/tests/sync/maintainer_reprocessing.rs b/tests/sync/maintainer_reprocessing.rs index 75438b3..599d9ff 100644 --- a/tests/sync/maintainer_reprocessing.rs +++ b/tests/sync/maintainer_reprocessing.rs @@ -912,7 +912,7 @@ async fn test_acceptance_replaces_existing_invitee_repository_with_newer_owner_s use crate::common::{create_test_repo_with_commit, CommitVariant}; let owner_relay = TestRelay::start_with_sync(None).await; - let invitee_relay = TestRelay::start_with_sync(None).await; + let invitee_relay = TestRelay::start_with_sync_debug(None).await; let shared_relay = TestRelay::start_with_sync(None).await; let owner_keys = Keys::generate(); let invitee_keys = Keys::generate();