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.
This commit is contained in:
parent
802e4726e3
commit
bdd991a5f1
|
|
@ -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<MockSigner>, 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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue