diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-11 13:09:39 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-11 13:09:39 +0000 |
| commit | 7146ee550944c71a4e48018a34820ce9a9d99f95 (patch) | |
| tree | 19400e16369f32630d193744de32eefeeacbc69e /tests/sync | |
| parent | a56e12e0aed87c68fd49b453b5c3dc0bfbf81285 (diff) | |
fix: classify sync events as startup/live based on EOSE, not relay type
Previously, events were classified as 'startup' or 'live' based on whether
they came from a bootstrap relay (is_bootstrap flag). This meant ALL events
from bootstrap relays were counted as 'startup', even events received after
the initial sync completed.
Now events are classified based on whether EOSE (End Of Stored Events) has
been received for that connection:
- Events BEFORE EOSE → 'startup' (historical events during initial sync)
- Events AFTER EOSE → 'live' (new events via real-time subscription)
This enables the test_live_sync_event_count test which validates that events
received after sync connection is established are counted as live events.
Also removed the #[ignore] attribute from test_live_sync_event_count since
the metrics are now properly wired up.
Diffstat (limited to 'tests/sync')
| -rw-r--r-- | tests/sync/metrics.rs | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/tests/sync/metrics.rs b/tests/sync/metrics.rs index 3accd0f..98ce4f3 100644 --- a/tests/sync/metrics.rs +++ b/tests/sync/metrics.rs | |||
| @@ -410,11 +410,7 @@ async fn test_connection_failure_increments_counter() { | |||
| 410 | /// This test validates that events received via live subscription | 410 | /// This test validates that events received via live subscription |
| 411 | /// (after sync connection is established) are counted separately | 411 | /// (after sync connection is established) are counted separately |
| 412 | /// from startup/bootstrap events. | 412 | /// from startup/bootstrap events. |
| 413 | /// | ||
| 414 | /// NOTE: This test may fail until sync metrics recording is fully wired up. | ||
| 415 | /// The test documents the expected behavior. | ||
| 416 | #[tokio::test] | 413 | #[tokio::test] |
| 417 | #[ignore] // Enable when live event sync metrics are wired up | ||
| 418 | async fn test_live_sync_event_count() { | 414 | async fn test_live_sync_event_count() { |
| 419 | let mut harness = MetricsTestHarness::with_sources(1).await; | 415 | let mut harness = MetricsTestHarness::with_sources(1).await; |
| 420 | 416 | ||
| @@ -437,8 +433,6 @@ async fn test_live_sync_event_count() { | |||
| 437 | let live_count = metrics.events_total("live"); | 433 | let live_count = metrics.events_total("live"); |
| 438 | println!("Live events synced: {:?}", live_count); | 434 | println!("Live events synced: {:?}", live_count); |
| 439 | 435 | ||
| 440 | // NOTE: This will likely fail until sync metrics are wired up | ||
| 441 | // Test documents the expectation | ||
| 442 | assert_eq!(live_count, Some(2), "Should have 2 live events"); | 436 | assert_eq!(live_count, Some(2), "Should have 2 live events"); |
| 443 | 437 | ||
| 444 | harness.stop_all().await; | 438 | harness.stop_all().await; |