From bdd991a5f1778628189cf0cafd5d7b18379fdb11 Mon Sep 17 00:00:00 2001 From: Adrian Duke Date: Tue, 21 Apr 2026 15:50:44 +0100 Subject: [PATCH] e2e: Fix race condition in test_non_fastforward_identity_doc Fixes an intermittent failure caused by a race condition with background gossip messages. Previously Eve's `RefsAnnounced` message could be processed by Bob after the test updated the identity document to include Alice-Laptop as a delegate. This caused Bob to unexpectedly fetch the issue in the background, failing the `!has_issue` assertion. We now explicitly wait for Bob to receive Eve's announcement before updating the identity document. --- crates/radicle-node/src/tests/e2e.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/radicle-node/src/tests/e2e.rs b/crates/radicle-node/src/tests/e2e.rs index ca543a96..4574d71c 100644 --- a/crates/radicle-node/src/tests/e2e.rs +++ b/crates/radicle-node/src/tests/e2e.rs @@ -1725,6 +1725,7 @@ fn test_non_fastforward_identity_doc() { let mut alice = alice.spawn(); let mut alice_laptop = alice_laptop.spawn(); let mut bob = bob.spawn(); + let bob_events = bob.handle.events(); let mut eve = eve.spawn(); let has_issue = |node: &NodeHandle, issue: &cob::ObjectId| -> bool { @@ -1770,6 +1771,13 @@ fn test_non_fastforward_identity_doc() { .unwrap(); assert!(has_issue(&eve, &issue)); + bob_events + .wait( + |e| matches!(e, Event::RefsAnnounced { nid, .. } if *nid == eve.id).then_some(()), + DEFAULT_TIMEOUT, + ) + .unwrap(); + // Alice updates the identity of the document to include her laptop let (prev, next) = { let repo = alice.storage.repository(rid).unwrap();