From c7045751da32e7c3cf3da3a6b90408e377dfb181 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 6 Apr 2023 16:02:16 +0200 Subject: [PATCH] Save server operations that were in the middle of being applied Previously, if the test panicked before it had a chance to fully apply an operation, it would end up not being saved in the plan. With this commit we will mark the operation as applied before we start processing it, and mark it as not applied if, once we're done, we've found out that it couldn't be applied. This is consistent with what we do for client operations. --- crates/collab/src/tests/randomized_integration_tests.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/collab/src/tests/randomized_integration_tests.rs b/crates/collab/src/tests/randomized_integration_tests.rs index 144484816b..6a13c4ef2e 100644 --- a/crates/collab/src/tests/randomized_integration_tests.rs +++ b/crates/collab/src/tests/randomized_integration_tests.rs @@ -121,6 +121,7 @@ async fn test_random_collaboration( loop { let Some((next_operation, applied)) = plan.lock().next_server_operation(&clients) else { break }; + applied.store(true, SeqCst); let did_apply = apply_server_operation( deterministic.clone(), &mut server, @@ -132,8 +133,8 @@ async fn test_random_collaboration( cx, ) .await; - if did_apply { - applied.store(true, SeqCst); + if !did_apply { + applied.store(false, SeqCst); } }