Files
ngit-grasp/tests/sync.rs
T
DanConwayDev ff388ce184 fix(sync): suppress naughty relay connection attempts
Persistent DNS, TLS, and protocol failures were recorded in the relay naughty list, but reconnect eligibility and every scheduling path ignored that state and continued announcing and launching retries after normal health backoff.

Consult the existing tracker both when deciding reconnect eligibility and at the shared connection-scheduling boundary before mutating lifecycle state or reserving worker capacity. This preserves the required first dial, suppresses all subsequent scheduling paths while the entry is live, and restores eligibility through the existing expiry behavior.

Add a scenario test with a deterministic broken WebSocket endpoint that proves only the classification dial reaches it across multiple reconnect ticks and no reconnect intent is emitted. Update the defensive-measures documentation to describe the enforced behavior.

This deliberately does not change error classification, expiry duration, Git-domain throttling, or transient relay backoff. Correctness assumes canonical relay URLs are used consistently by reconnect selection, the scheduler, and naughty-list recording.

Validated with nix develop -c cargo test (617 library tests and all integration/doc tests green before the eligibility refinement), the full sync target after refinement (79 passed and 1 ignored), focused health tests (16 passed), and git diff --check.
2026-08-05 14:47:39 +00:00

47 lines
1.4 KiB
Rust

//! Proactive Sync Integration Tests
//!
//! This test file organizes tests for ngit-grasp's proactive sync functionality.
//! Tests are grouped into submodules by sync scenario:
//!
//! - `historic_sync` - Tests for sync from pre-configured bootstrap relay (historic events)
//! - `discovery` - Tests for relay discovery from announcement events
//! - `live_sync` - Tests for real-time sync after connection established
//! - `tag_variations` - Tests for different Layer 2/3 tag types
//! - `catchup` - Tests for catchup sync after disconnect (not yet implemented)
//! - `metrics` - Tests for Prometheus metrics integration
//!
//! # Running Tests
//!
//! ```bash
//! # Run all sync tests
//! cargo test --test sync
//!
//! # Run with output
//! cargo test --test sync -- --nocapture
//!
//! # Run specific test
//! cargo test --test sync test_bootstrap_syncs -- --nocapture
//!
//! # Run ignored tests (like catchup)
//! cargo test --test sync -- --ignored
//! ```
// Include the common test utilities
mod common;
// Include sync test submodules (located in tests/sync/)
mod sync {
pub mod catchup;
pub mod discovery;
pub mod historic_recovery;
pub mod historic_sync;
pub mod live_sync;
pub mod maintainer_reprocessing;
pub mod metrics;
pub mod naughty_list_scheduling;
pub mod neg_concurrency;
pub mod purgatory_fetch;
pub mod req_concurrency;
pub mod tag_variations;
}