mirror of
https://relay.ngit.dev/npub15qydau2hjma6ngxkl2cyar74wzyjshvl65za5k5rl69264ar2exs5cyejr/ngit-grasp.git
synced 2026-10-05 15:08:24 +00:00
test(sync): await connection attempts instead of status notifications
Five sync tests waited for relay connections with connect().and_wait(30 s). That call checks the relay status and then subscribes to status notifications; a loopback connection that completes between the two is never observed, and the caller sleeps for the whole timeout. Under scheduler pressure this turns a sub-millisecond connect into a 30 s stall. Use the shared connect_client helper, which awaits the connection attempts through try_connect and fails the test if any relay refuses. Validation: the sync test binary passed (114 tests, 1 ignored) after the change; formatting and all-targets Clippy with warnings denied pass. Assisted-by: Claude Fable 5.1 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
6c3b33e3a6
commit
0c755beb44
@@ -454,7 +454,7 @@ async fn test_pagination_for_large_historic_sync() {
|
||||
.add_relay(syncing.url())
|
||||
.await
|
||||
.expect("Failed to add syncing relay to client");
|
||||
client.connect().and_wait(Duration::from_secs(30)).await;
|
||||
crate::common::relay::connect_client(&client).await;
|
||||
|
||||
// Poll until every issue has paginated across, up to a bounded deadline.
|
||||
let deadline = tokio::time::Instant::now() + Duration::from_secs(30);
|
||||
|
||||
@@ -486,7 +486,7 @@ async fn test_live_sync_layer3_events() {
|
||||
.authenticator(SignerAuthenticator::new(temp_keys))
|
||||
.build();
|
||||
if client.add_relay(relay_b.url()).await.is_ok() {
|
||||
client.connect().and_wait(Duration::from_secs(30)).await;
|
||||
crate::common::relay::connect_client(&client).await;
|
||||
|
||||
let fetch_filter = Filter::new().kind(Kind::Comment).id(comment_id);
|
||||
|
||||
@@ -642,7 +642,7 @@ async fn test_live_sync_event_ordering() {
|
||||
|
||||
let events_found: Vec<Event>;
|
||||
if client.add_relay(relay_b.url()).await.is_ok() {
|
||||
client.connect().and_wait(Duration::from_secs(30)).await;
|
||||
crate::common::relay::connect_client(&client).await;
|
||||
|
||||
let filter = Filter::new().kind(Kind::GitIssue).author(keys.public_key());
|
||||
|
||||
|
||||
@@ -159,10 +159,7 @@ async fn purgatory_fetch_batches_available_tips_and_isolates_missing_oids() {
|
||||
.add_relay(source.url())
|
||||
.await
|
||||
.expect("add source relay");
|
||||
source_client
|
||||
.connect()
|
||||
.and_wait(Duration::from_secs(30))
|
||||
.await;
|
||||
crate::common::relay::connect_client(&source_client).await;
|
||||
source_client
|
||||
.send_event(&source_announcement)
|
||||
.await
|
||||
@@ -239,10 +236,7 @@ async fn purgatory_fetch_batches_available_tips_and_isolates_missing_oids() {
|
||||
.add_relay(mock.url())
|
||||
.await
|
||||
.expect("add mock relay");
|
||||
mock_client
|
||||
.connect()
|
||||
.and_wait(Duration::from_secs(30))
|
||||
.await;
|
||||
crate::common::relay::connect_client(&mock_client).await;
|
||||
mock_client
|
||||
.send_event(&syncing_announcement)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user