From b5b260fc28f0d19ec85a1e8e27d41d3c0be648fe Mon Sep 17 00:00:00 2001 From: Lee Danilek Date: Tue, 14 Jan 2025 16:51:05 -0500 Subject: [PATCH] [ENG-8227] fix test_new_sync_query_after_disconnect (#33104) test was failing nondeterministically because `t.server.latest_timestamp().await?` is the timestamp of the latest mutation, and there was a chance for the mutation to propagate to the client before the `.add_sync_query("getConversations", assert_obj!())` fully executes. So there's not always a result. The fix is to do the second mutation after the query is registered, so waiting for the client to be aware of the mutation also means the query must be ready. GitOrigin-RevId: 9406d69ea542af5c27ac5ebf5846789b3489978e --- crates/simulation/src/tests/sync.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/simulation/src/tests/sync.rs b/crates/simulation/src/tests/sync.rs index 09736d23..abae80fe 100644 --- a/crates/simulation/src/tests/sync.rs +++ b/crates/simulation/src/tests/sync.rs @@ -140,7 +140,6 @@ async fn test_sync(rt: TestRuntime) -> anyhow::Result<()> { .await } -#[ignore] // Test disabled due to ENG-8227 #[convex_macro::test_runtime] async fn test_new_sync_query_after_disconnect(rt: TestRuntime) -> anyhow::Result<()> { SimulationTest::run( @@ -153,14 +152,14 @@ async fn test_new_sync_query_after_disconnect(rt: TestRuntime) -> anyhow::Result t.server .mutation("misc:init".parse()?, assert_obj!()) .await??; - t.server - .mutation("conversations:create".parse()?, assert_obj!("emoji" => "a")) - .await??; let client = &t.js_clients[0]; let subscription_id = client .add_sync_query("getConversations", assert_obj!()) .await?; + t.server + .mutation("conversations:create".parse()?, assert_obj!("emoji" => "a")) + .await??; let ts = t.server.latest_timestamp().await?; client.wait_for_server_ts(ts).await?;