diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 15:32:02 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-01-09 15:32:02 +0000 |
| commit | 29be4cb7d0fbd29325c995a76ba1b1f47beecca5 (patch) | |
| tree | 3f31325217e60d9b207753e70457648758249008 /tests/common/sync_helpers.rs | |
| parent | 208ea60836cfc98857cf3359a73d8874ed5d935a (diff) | |
Fix sync tests after Syncing status introduction
- Fix relay_connected() helper to check v >= 2 (Syncing/Connected states)
- Fix unit test to use status value 3 (Connected) instead of 1 (Connecting)
- Fix clippy warning: use .to_vec() instead of .iter().cloned().collect()
All 61 sync integration tests now passing.
All 238 unit tests passing.
Clippy clean.
Diffstat (limited to 'tests/common/sync_helpers.rs')
| -rw-r--r-- | tests/common/sync_helpers.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/common/sync_helpers.rs b/tests/common/sync_helpers.rs index 27422e9..d6a6ee4 100644 --- a/tests/common/sync_helpers.rs +++ b/tests/common/sync_helpers.rs | |||
| @@ -708,7 +708,7 @@ impl ParsedMetrics { | |||
| 708 | /// Check if a specific relay is connected | 708 | /// Check if a specific relay is connected |
| 709 | pub fn relay_connected(&self, relay: &str) -> Option<bool> { | 709 | pub fn relay_connected(&self, relay: &str) -> Option<bool> { |
| 710 | self.gauge("ngit_sync_relay_connected", &[("relay", relay)]) | 710 | self.gauge("ngit_sync_relay_connected", &[("relay", relay)]) |
| 711 | .map(|v| v == 1) | 711 | .map(|v| v >= 2) // Syncing (2), Connected (3), or ConnectedHistoricSyncFailures (4) |
| 712 | } | 712 | } |
| 713 | 713 | ||
| 714 | /// Get total number of connected relays | 714 | /// Get total number of connected relays |
| @@ -1052,7 +1052,7 @@ mod tests { | |||
| 1052 | 1052 | ||
| 1053 | #[test] | 1053 | #[test] |
| 1054 | fn test_parse_metric_with_relay_url_label() { | 1054 | fn test_parse_metric_with_relay_url_label() { |
| 1055 | let text = r#"ngit_sync_relay_connected{relay="ws://127.0.0.1:12345"} 1"#; | 1055 | let text = r#"ngit_sync_relay_connected{relay="ws://127.0.0.1:12345"} 3"#; |
| 1056 | let metrics = ParsedMetrics::parse(text); | 1056 | let metrics = ParsedMetrics::parse(text); |
| 1057 | assert_eq!(metrics.relay_connected("ws://127.0.0.1:12345"), Some(true)); | 1057 | assert_eq!(metrics.relay_connected("ws://127.0.0.1:12345"), Some(true)); |
| 1058 | } | 1058 | } |