diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-26 15:42:09 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-02-26 15:42:09 +0000 |
| commit | 9d86cf15f0275ffeee4519bd054e3b61dc8992ac (patch) | |
| tree | 65b5d5ffb2a11b5ecd05d01e63fb5a4a0f8b6e06 /tests/sync | |
| parent | a2ecfc5a63311570f0f90c7ee40117e289639cb8 (diff) | |
chore: apply cargo fmt and fix clippy warnings
Fix pre-existing clippy lints:
- &PathBuf -> &Path in audit_cleanup.rs
- too_many_arguments on process_newly_available_git_data,
process_purgatory_announcements, and HttpService::new
- clone_on_copy for PublicKey (Copy type) in purgatory cleanup loop
Diffstat (limited to 'tests/sync')
| -rw-r--r-- | tests/sync/discovery.rs | 6 | ||||
| -rw-r--r-- | tests/sync/maintainer_reprocessing.rs | 25 | ||||
| -rw-r--r-- | tests/sync/metrics.rs | 19 |
3 files changed, 32 insertions, 18 deletions
diff --git a/tests/sync/discovery.rs b/tests/sync/discovery.rs index d45a290..ee675e6 100644 --- a/tests/sync/discovery.rs +++ b/tests/sync/discovery.rs | |||
| @@ -183,7 +183,10 @@ async fn test_relay_discovery_via_announcements_with_historic_sync() { | |||
| 183 | let (announcement, _git_dir_a) = | 183 | let (announcement, _git_dir_a) = |
| 184 | setup_announcement_on_relay(&relay_a, &keys, &domain_refs, repo_id).await; | 184 | setup_announcement_on_relay(&relay_a, &keys, &domain_refs, repo_id).await; |
| 185 | let announcement_id = announcement.id; | 185 | let announcement_id = announcement.id; |
| 186 | println!("Announcement {} set up on relay_a with git data (Layer 1)", announcement_id); | 186 | println!( |
| 187 | "Announcement {} set up on relay_a with git data (Layer 1)", | ||
| 188 | announcement_id | ||
| 189 | ); | ||
| 187 | 190 | ||
| 188 | // Build repo coordinate for Layer 2 reference | 191 | // Build repo coordinate for Layer 2 reference |
| 189 | let repo_coord = repo_coord(&keys, repo_id); | 192 | let repo_coord = repo_coord(&keys, repo_id); |
| @@ -235,4 +238,3 @@ async fn test_relay_discovery_via_announcements_with_historic_sync() { | |||
| 235 | issue_id | 238 | issue_id |
| 236 | ); | 239 | ); |
| 237 | } | 240 | } |
| 238 | |||
diff --git a/tests/sync/maintainer_reprocessing.rs b/tests/sync/maintainer_reprocessing.rs index ff1eb43..9154ee5 100644 --- a/tests/sync/maintainer_reprocessing.rs +++ b/tests/sync/maintainer_reprocessing.rs | |||
| @@ -70,17 +70,15 @@ async fn test_maintainer_announcement_reprocessed_immediately() { | |||
| 70 | identifier | 70 | identifier |
| 71 | )], | 71 | )], |
| 72 | ), | 72 | ), |
| 73 | Tag::custom( | 73 | Tag::custom(TagKind::custom("relays"), vec![relay_a.url().to_string()]), |
| 74 | TagKind::custom("relays"), | ||
| 75 | vec![relay_a.url().to_string()], | ||
| 76 | ), | ||
| 77 | ]) | 74 | ]) |
| 78 | .sign_with_keys(&maintainer_keys) | 75 | .sign_with_keys(&maintainer_keys) |
| 79 | .unwrap(); | 76 | .unwrap(); |
| 80 | send_to_relay(&relay_a, &maintainer_announcement).await.unwrap(); | 77 | send_to_relay(&relay_a, &maintainer_announcement) |
| 78 | .await | ||
| 79 | .unwrap(); | ||
| 81 | let _git_dir_maintainer = | 80 | let _git_dir_maintainer = |
| 82 | push_git_data_to_relay(&relay_a, &maintainer_keys, identifier, &[&relay_a.domain()]) | 81 | push_git_data_to_relay(&relay_a, &maintainer_keys, identifier, &[&relay_a.domain()]).await; |
| 83 | .await; | ||
| 84 | println!("✓ Maintainer announcement + git data pushed to relay_a"); | 82 | println!("✓ Maintainer announcement + git data pushed to relay_a"); |
| 85 | 83 | ||
| 86 | // Step 2: Start relay_b with relay_a as bootstrap so its SyncManager connects immediately. | 84 | // Step 2: Start relay_b with relay_a as bootstrap so its SyncManager connects immediately. |
| @@ -134,7 +132,9 @@ async fn test_maintainer_announcement_reprocessed_immediately() { | |||
| 134 | // re-processing of the maintainer announcement via our new code path. | 132 | // re-processing of the maintainer announcement via our new code path. |
| 135 | let _git_dir_owner = | 133 | let _git_dir_owner = |
| 136 | push_git_data_to_relay(&relay_b, &owner_keys, identifier, &[&relay_b.domain()]).await; | 134 | push_git_data_to_relay(&relay_b, &owner_keys, identifier, &[&relay_b.domain()]).await; |
| 137 | println!("✓ Owner git data pushed to relay_b (owner announcement promoted, hot cache re-processed)"); | 135 | println!( |
| 136 | "✓ Owner git data pushed to relay_b (owner announcement promoted, hot cache re-processed)" | ||
| 137 | ); | ||
| 138 | 138 | ||
| 139 | // Step 5: Wait briefly for async processing to complete. | 139 | // Step 5: Wait briefly for async processing to complete. |
| 140 | tokio::time::sleep(Duration::from_secs(1)).await; | 140 | tokio::time::sleep(Duration::from_secs(1)).await; |
| @@ -363,9 +363,12 @@ async fn test_multiple_maintainers_all_reprocessed() { | |||
| 363 | .kind(Kind::GitRepoAnnouncement) | 363 | .kind(Kind::GitRepoAnnouncement) |
| 364 | .author(keys.public_key()) | 364 | .author(keys.public_key()) |
| 365 | .identifier(identifier); | 365 | .identifier(identifier); |
| 366 | let found = | 366 | let found = wait_for_event_on_relay(relay_a.url(), filter, Duration::from_secs(10)).await; |
| 367 | wait_for_event_on_relay(relay_a.url(), filter, Duration::from_secs(10)).await; | 367 | assert!( |
| 368 | assert!(found, "{} announcement should be in relay_a before starting relay_b", name); | 368 | found, |
| 369 | "{} announcement should be in relay_a before starting relay_b", | ||
| 370 | name | ||
| 371 | ); | ||
| 369 | } | 372 | } |
| 370 | println!("✓ All three maintainer announcements confirmed in relay_a's DB"); | 373 | println!("✓ All three maintainer announcements confirmed in relay_a's DB"); |
| 371 | 374 | ||
diff --git a/tests/sync/metrics.rs b/tests/sync/metrics.rs index e973bbb..996c8b7 100644 --- a/tests/sync/metrics.rs +++ b/tests/sync/metrics.rs | |||
| @@ -417,9 +417,12 @@ async fn test_live_sync_event_count() { | |||
| 417 | println!("Announcement set up on source relay with git data"); | 417 | println!("Announcement set up on source relay with git data"); |
| 418 | 418 | ||
| 419 | // Start syncing relay with pre-allocated port | 419 | // Start syncing relay with pre-allocated port |
| 420 | let syncing_relay = | 420 | let syncing_relay = TestRelay::start_on_port_with_options( |
| 421 | TestRelay::start_on_port_with_options(sync_port, Some(source_relay.url().to_string()), false) | 421 | sync_port, |
| 422 | .await; | 422 | Some(source_relay.url().to_string()), |
| 423 | false, | ||
| 424 | ) | ||
| 425 | .await; | ||
| 423 | println!("Syncing relay started at {}", syncing_relay.url()); | 426 | println!("Syncing relay started at {}", syncing_relay.url()); |
| 424 | 427 | ||
| 425 | // Wait for sync connection to be fully established with EOSE received | 428 | // Wait for sync connection to be fully established with EOSE received |
| @@ -458,8 +461,14 @@ async fn test_live_sync_event_count() { | |||
| 458 | let client = TestClient::new(source_relay.url(), keys.clone()) | 461 | let client = TestClient::new(source_relay.url(), keys.clone()) |
| 459 | .await | 462 | .await |
| 460 | .expect("Failed to connect to source"); | 463 | .expect("Failed to connect to source"); |
| 461 | client.send_event(&patch1).await.expect("Failed to send patch 1"); | 464 | client |
| 462 | client.send_event(&patch2).await.expect("Failed to send patch 2"); | 465 | .send_event(&patch1) |
| 466 | .await | ||
| 467 | .expect("Failed to send patch 1"); | ||
| 468 | client | ||
| 469 | .send_event(&patch2) | ||
| 470 | .await | ||
| 471 | .expect("Failed to send patch 2"); | ||
| 463 | client.disconnect().await; | 472 | client.disconnect().await; |
| 464 | println!("Two patches sent to source relay (live mode)"); | 473 | println!("Two patches sent to source relay (live mode)"); |
| 465 | 474 | ||