Save server operations that were in the middle of being applied

Antonio Scandurra created

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.

Change summary

crates/collab/src/tests/randomized_integration_tests.rs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

Detailed changes

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);
         }
     }