upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/sync
diff options
context:
space:
mode:
Diffstat (limited to 'tests/sync')
-rw-r--r--tests/sync/metrics.rs17
1 files changed, 13 insertions, 4 deletions
diff --git a/tests/sync/metrics.rs b/tests/sync/metrics.rs
index e0e9d48..7675489 100644
--- a/tests/sync/metrics.rs
+++ b/tests/sync/metrics.rs
@@ -16,8 +16,8 @@ use nostr_sdk::prelude::*;
16 16
17use crate::common::{ 17use crate::common::{
18 sync_helpers::{ 18 sync_helpers::{
19 create_repo_announcement, fetch_metrics, MetricsTestHarness, ParsedMetrics, TestClient, 19 create_repo_announcement, fetch_metrics, wait_for_sync_connection, MetricsTestHarness,
20 KIND_REPOSITORY_STATE, 20 ParsedMetrics, TestClient, KIND_REPOSITORY_STATE,
21 }, 21 },
22 TestRelay, 22 TestRelay,
23}; 23};
@@ -418,7 +418,16 @@ async fn test_live_sync_event_count() {
418 418
419 // Start syncing relay with pre-allocated port 419 // Start syncing relay with pre-allocated port
420 harness.start_syncing_relay_on_port(0, sync_port).await; 420 harness.start_syncing_relay_on_port(0, sync_port).await;
421 tokio::time::sleep(Duration::from_secs(2)).await; 421
422 // Wait for sync connection to be fully established with EOSE received
423 // This ensures we're in "live" mode before submitting test events
424 let sync_url = format!("ws://{}", sync_domain);
425 wait_for_sync_connection(&sync_url, 1, Duration::from_secs(10))
426 .await
427 .expect("Sync connection should be established");
428
429 // Additional small delay to ensure EOSE has been processed
430 tokio::time::sleep(Duration::from_millis(500)).await;
422 431
423 // Now add events - these should be "live" not "startup" 432 // Now add events - these should be "live" not "startup"
424 // Include BOTH domains so events are accepted by both relays 433 // Include BOTH domains so events are accepted by both relays
@@ -434,7 +443,7 @@ async fn test_live_sync_event_count() {
434 .collect(); 443 .collect();
435 harness.submit_events(0, &events).await.unwrap(); 444 harness.submit_events(0, &events).await.unwrap();
436 445
437 // Wait longer for live events to be processed and metrics updated 446 // Wait for live events to be processed and metrics updated
438 tokio::time::sleep(Duration::from_secs(4)).await; 447 tokio::time::sleep(Duration::from_secs(4)).await;
439 let metrics = harness.get_metrics().await.unwrap(); 448 let metrics = harness.get_metrics().await.unwrap();
440 449