mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
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.
This commit is contained in:
@@ -91,6 +91,9 @@ struct RelayOptions {
|
||||
relay_data_path: Option<PathBuf>,
|
||||
deletion_lifecycle: Option<DeletionLifecycleOptions>,
|
||||
rejected_hot_cache_duration_secs: Option<u64>,
|
||||
/// Application log level for tests that observe a diagnostic as an
|
||||
/// ordering barrier. Other fixtures retain the production `info` default.
|
||||
log_level: Option<String>,
|
||||
relay_max_subscriptions: Option<usize>,
|
||||
sync_recursive_descendant_limit: Option<usize>,
|
||||
private_members: Option<String>,
|
||||
@@ -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<String>) -> 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());
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user