diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-11 16:53:03 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-11 16:53:03 +0000 |
| commit | 2a9160836bb87fdea3ae891563b0169c68d1c2ab (patch) | |
| tree | 583c890687beaf7f380fc0be131bdf17485f06fa /tests/sync/discovery.rs | |
| parent | 52489d3b1a7d79e164b4cc901b53fd06c05ce1b1 (diff) | |
fix: resolve all fmt and clippy warnings
Main lib (src/):
- Add #[allow(dead_code)] for build_info field (stored to prevent Prometheus unregistration)
- Add #[allow(dead_code)] for first_seen field (reserved for future rate limiting)
- Replace .or_insert_with(RelaySyncNeeds::default) with .or_default()
- Replace manual div_ceil implementations with .div_ceil(100)
Test code (tests/):
- Replace .expect(&format!(...)) with .unwrap_or_else(|_| panic!(...))
- Remove needless borrows in fetch_metrics() calls
- Add #[allow(dead_code)] and #[allow(unused_imports)] to test helpers module
grasp-audit:
- Apply cargo fmt to fix formatting
Diffstat (limited to 'tests/sync/discovery.rs')
| -rw-r--r-- | tests/sync/discovery.rs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/tests/sync/discovery.rs b/tests/sync/discovery.rs index 9e27f9e..ed3e9bb 100644 --- a/tests/sync/discovery.rs +++ b/tests/sync/discovery.rs | |||
| @@ -88,7 +88,8 @@ async fn test_discovers_layer3_via_layer2() { | |||
| 88 | ); | 88 | ); |
| 89 | 89 | ||
| 90 | // 6. Create a patch event (Layer 2) that references the announcement | 90 | // 6. Create a patch event (Layer 2) that references the announcement |
| 91 | let patch = create_event_referencing_repo(&keys, &repo_coord, KIND_PATCH, "Test patch proposal"); | 91 | let patch = |
| 92 | create_event_referencing_repo(&keys, &repo_coord, KIND_PATCH, "Test patch proposal"); | ||
| 92 | let patch_id = patch.id; | 93 | let patch_id = patch.id; |
| 93 | 94 | ||
| 94 | println!("Created patch {} (kind {})", patch_id, patch.kind.as_u16()); | 95 | println!("Created patch {} (kind {})", patch_id, patch.kind.as_u16()); |
| @@ -252,7 +253,8 @@ async fn test_layer2_discovery_with_chain() { | |||
| 252 | let issue_filter = Filter::new() | 253 | let issue_filter = Filter::new() |
| 253 | .kind(Kind::Custom(KIND_ISSUE)) | 254 | .kind(Kind::Custom(KIND_ISSUE)) |
| 254 | .author(keys.public_key()); | 255 | .author(keys.public_key()); |
| 255 | let issue_synced = wait_for_event_on_relay(relay_b.url(), issue_filter, Duration::from_secs(5)).await; | 256 | let issue_synced = |
| 257 | wait_for_event_on_relay(relay_b.url(), issue_filter, Duration::from_secs(5)).await; | ||
| 256 | 258 | ||
| 257 | println!("Sync result:"); | 259 | println!("Sync result:"); |
| 258 | println!(" Issue {} synced: {}", issue_id, issue_synced); | 260 | println!(" Issue {} synced: {}", issue_id, issue_synced); |
| @@ -296,7 +298,7 @@ async fn test_layer2_discovery_with_chain() { | |||
| 296 | #[tokio::test] | 298 | #[tokio::test] |
| 297 | async fn test_recursive_relay_discovery_syncs_announcement() { | 299 | async fn test_recursive_relay_discovery_syncs_announcement() { |
| 298 | // 1. Start all three relays | 300 | // 1. Start all three relays |
| 299 | 301 | ||
| 300 | // relay_b - will be the bootstrap relay, has announcement_x | 302 | // relay_b - will be the bootstrap relay, has announcement_x |
| 301 | let relay_b = TestRelay::start().await; | 303 | let relay_b = TestRelay::start().await; |
| 302 | println!( | 304 | println!( |
| @@ -344,7 +346,10 @@ async fn test_recursive_relay_discovery_syncs_announcement() { | |||
| 344 | "repo-y-ac-only", | 346 | "repo-y-ac-only", |
| 345 | ); | 347 | ); |
| 346 | let announcement_y_id = announcement_y.id; | 348 | let announcement_y_id = announcement_y.id; |
| 347 | println!("Created announcement_y {} listing A+C only", announcement_y_id); | 349 | println!( |
| 350 | "Created announcement_y {} listing A+C only", | ||
| 351 | announcement_y_id | ||
| 352 | ); | ||
| 348 | for tag in announcement_y.tags.iter() { | 353 | for tag in announcement_y.tags.iter() { |
| 349 | println!(" Tag: {:?}", tag.as_slice()); | 354 | println!(" Tag: {:?}", tag.as_slice()); |
| 350 | } | 355 | } |
| @@ -425,4 +430,4 @@ async fn test_recursive_relay_discovery_syncs_announcement() { | |||
| 425 | "announcement_y {} should have synced from discovered relay_c to relay_a (recursive discovery)", | 430 | "announcement_y {} should have synced from discovered relay_c to relay_a (recursive discovery)", |
| 426 | announcement_y_id | 431 | announcement_y_id |
| 427 | ); | 432 | ); |
| 428 | } \ No newline at end of file | 433 | } |