diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-08 12:50:34 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2025-12-08 12:50:34 +0000 |
| commit | efe3e43cf792abd8bb256121ebf84ae04836313a (patch) | |
| tree | 2aa626f43817d7f86145ba4c6c09ac8660df1a9b /tests/proactive_sync_multi.rs | |
| parent | b4da09689ee0bd6ac327a6ed7ffb01e2175e2596 (diff) | |
tests: discover and sync from relay in annocunement published directly
Diffstat (limited to 'tests/proactive_sync_multi.rs')
| -rw-r--r-- | tests/proactive_sync_multi.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/proactive_sync_multi.rs b/tests/proactive_sync_multi.rs index e07ddbe..de4183a 100644 --- a/tests/proactive_sync_multi.rs +++ b/tests/proactive_sync_multi.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | //! GRASP-02 Phase 2: Multi-Relay Proactive Sync Integration Tests | 1 | //! GRASP-02 Phase 2: Multi-Relay Proactive Sync Integration Tests |
| 2 | //! | 2 | //! |
| 3 | //! Tests the multi-relay proactive sync functionality. | 3 | //! Tests the multi-relay proactive sync functionality. |
| 4 | //! | 4 | //! |
| 5 | //! Note: Integration tests for sync timing are inherently flaky due to | 5 | //! Note: Integration tests for sync timing are inherently flaky due to |
| 6 | //! subprocess communication latency. Unit tests for FilterService and | 6 | //! subprocess communication latency. Unit tests for FilterService and |
| 7 | //! SyncManager cover the core logic in src/sync/filter.rs and manager.rs. | 7 | //! SyncManager cover the core logic in src/sync/filter.rs and manager.rs. |
| @@ -32,7 +32,7 @@ async fn test_sync_relay_starts_with_source_url() { | |||
| 32 | tokio::time::sleep(Duration::from_millis(200)).await; | 32 | tokio::time::sleep(Duration::from_millis(200)).await; |
| 33 | 33 | ||
| 34 | // Start syncing relay (relay_sync) configured to sync from relay_a | 34 | // Start syncing relay (relay_sync) configured to sync from relay_a |
| 35 | let relay_sync = TestRelay::start_with_sync(relay_a.url()).await; | 35 | let relay_sync = TestRelay::start_with_sync(Some(relay_a.url().into())).await; |
| 36 | 36 | ||
| 37 | // Give time for connection establishment | 37 | // Give time for connection establishment |
| 38 | tokio::time::sleep(Duration::from_millis(500)).await; | 38 | tokio::time::sleep(Duration::from_millis(500)).await; |
| @@ -134,7 +134,7 @@ async fn test_event_submission_to_relay() { | |||
| 134 | // Send event - it may or may not be accepted depending on validation | 134 | // Send event - it may or may not be accepted depending on validation |
| 135 | // The point is the connection and submission work | 135 | // The point is the connection and submission work |
| 136 | let result = client.send_event(&event).await; | 136 | let result = client.send_event(&event).await; |
| 137 | 137 | ||
| 138 | // Clean up | 138 | // Clean up |
| 139 | client.disconnect().await; | 139 | client.disconnect().await; |
| 140 | relay.stop().await; | 140 | relay.stop().await; |
| @@ -148,11 +148,11 @@ async fn test_event_submission_to_relay() { | |||
| 148 | fn test_domain_extraction() { | 148 | fn test_domain_extraction() { |
| 149 | // This tests the domain() method of TestRelay indirectly | 149 | // This tests the domain() method of TestRelay indirectly |
| 150 | // by verifying the format matches expectations | 150 | // by verifying the format matches expectations |
| 151 | 151 | ||
| 152 | // Domain should be in format "127.0.0.1:PORT" | 152 | // Domain should be in format "127.0.0.1:PORT" |
| 153 | let example_domain = "127.0.0.1:8080"; | 153 | let example_domain = "127.0.0.1:8080"; |
| 154 | assert!(example_domain.starts_with("127.0.0.1:")); | 154 | assert!(example_domain.starts_with("127.0.0.1:")); |
| 155 | 155 | ||
| 156 | // URL should be in format "ws://127.0.0.1:PORT" | 156 | // URL should be in format "ws://127.0.0.1:PORT" |
| 157 | let example_url = "ws://127.0.0.1:8080"; | 157 | let example_url = "ws://127.0.0.1:8080"; |
| 158 | assert!(example_url.starts_with("ws://127.0.0.1:")); | 158 | assert!(example_url.starts_with("ws://127.0.0.1:")); |
| @@ -166,12 +166,12 @@ async fn test_sync_configuration_applied() { | |||
| 166 | tokio::time::sleep(Duration::from_millis(200)).await; | 166 | tokio::time::sleep(Duration::from_millis(200)).await; |
| 167 | 167 | ||
| 168 | // Start syncing relay with explicit sync URL | 168 | // Start syncing relay with explicit sync URL |
| 169 | let relay_sync = TestRelay::start_with_sync(relay_source.url()).await; | 169 | let relay_sync = TestRelay::start_with_sync(Some(relay_source.url().into())).await; |
| 170 | tokio::time::sleep(Duration::from_millis(300)).await; | 170 | tokio::time::sleep(Duration::from_millis(300)).await; |
| 171 | 171 | ||
| 172 | // Both relays should be running | 172 | // Both relays should be running |
| 173 | // The sync relay has NGIT_SYNC_BOOTSTRAP_RELAY_URL set (verified by relay starting) | 173 | // The sync relay has NGIT_SYNC_BOOTSTRAP_RELAY_URL set (verified by relay starting) |
| 174 | 174 | ||
| 175 | let client_source = Client::default(); | 175 | let client_source = Client::default(); |
| 176 | client_source | 176 | client_source |
| 177 | .add_relay(relay_source.url()) | 177 | .add_relay(relay_source.url()) |
| @@ -191,4 +191,4 @@ async fn test_sync_configuration_applied() { | |||
| 191 | client_source.disconnect().await; | 191 | client_source.disconnect().await; |
| 192 | relay_sync.stop().await; | 192 | relay_sync.stop().await; |
| 193 | relay_source.stop().await; | 193 | relay_source.stop().await; |
| 194 | } \ No newline at end of file | 194 | } |