upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/common
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2025-12-11 11:19:38 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2025-12-11 11:19:38 +0000
commitc82684092c7b4f81e49833b0888500fcb9851218 (patch)
tree6853940a5bb975aa17e1f91be988e3b3303ff39f /tests/common
parent532a7d0d5d8461bad0fc799aacb5eea0135f79f3 (diff)
fix(sync): improve metrics recording and connection failure detection
Changes: - Fix connection attempt metrics: record success/failure based on actual connection result instead of pre-emptively recording failure - Add health tracker integration on connection failure: call record_failure() and record_health_state() in error path - Add connection verification in relay_connection.rs: wait 500ms after connect() then verify is_connected() to detect silent failures - Add configurable disconnect check interval via NGIT_SYNC_DISCONNECT_CHECK_INTERVAL_SECS env var - Update TestRelay with fast test settings: startup_delay=0, jitter=0, disconnect_check_interval=1s - Add debug output to metrics tests for investigation Note: Tests may still fail due to 5-second base backoff in health tracker. A follow-up task will add NGIT_SYNC_BASE_BACKOFF_SECS config parameter to allow faster test cycles. Related: metrics-wiring-plan.md Tasks 1 & 2
Diffstat (limited to 'tests/common')
-rw-r--r--tests/common/relay.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/common/relay.rs b/tests/common/relay.rs
index d954e34..b11dde3 100644
--- a/tests/common/relay.rs
+++ b/tests/common/relay.rs
@@ -94,6 +94,9 @@ impl TestRelay {
94 .env("NGIT_DATABASE_BACKEND", "memory") // Force in-memory database for isolation 94 .env("NGIT_DATABASE_BACKEND", "memory") // Force in-memory database for isolation
95 .env("NGIT_OWNER_NPUB", &test_npub) 95 .env("NGIT_OWNER_NPUB", &test_npub)
96 .env("NGIT_SYNC_BATCH_WINDOW_MS", "200") // Fast batch window for tests (200ms instead of 5s default) 96 .env("NGIT_SYNC_BATCH_WINDOW_MS", "200") // Fast batch window for tests (200ms instead of 5s default)
97 .env("NGIT_SYNC_STARTUP_DELAY_SECS", "0") // No startup delay for faster tests
98 .env("NGIT_SYNC_STARTUP_JITTER_MS", "0") // No jitter for tests
99 .env("NGIT_SYNC_DISCONNECT_CHECK_INTERVAL_SECS", "1") // Fast reconnect attempts for tests
97 .env("RUST_LOG", "info") // Enable INFO logging for diagnostics 100 .env("RUST_LOG", "info") // Enable INFO logging for diagnostics
98 .stdout(Stdio::null()) // Disable stderr for cleaner test output 101 .stdout(Stdio::null()) // Disable stderr for cleaner test output
99 // .stdout(Stdio::inherit()) // Show stdout for diagnostics 102 // .stdout(Stdio::inherit()) // Show stdout for diagnostics