Skip to content

Commit f61a1b4

Browse files
authored
Fix race in tq_proxy test (#9447)
Fixes #9424
1 parent 42adbe5 commit f61a1b4

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

trust-quorum/src/task.rs

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2219,7 +2219,7 @@ mod tests {
22192219
);
22202220

22212221
// PrepareAndCommit should return pending, because it has to compute
2222-
// it's own keyshare for the new config, which will eventually fail.
2222+
// its own keyshare for the new config, which will eventually fail.
22232223
//
22242224
// Nexus will never actually send a `PrepareAndCommit` when there hasn't
22252225
// been a commit. This is just here to check the behavior of the proxy
@@ -2266,11 +2266,26 @@ mod tests {
22662266
.unwrap();
22672267

22682268
// Now ensure we can get the status for the last node again.
2269-
let status = proxy
2270-
.status(destination.clone())
2271-
.await
2272-
.expect("successful status request");
2273-
assert_matches!(status, NodeStatus { .. });
2269+
//
2270+
// We must wait for connection here, because we don't know if the unlock
2271+
// at the last node (4) was a result of receiving the share from the proxy node
2272+
// (node 1).
2273+
wait_for_condition(
2274+
async || {
2275+
let Ok(status) = proxy.status(destination.clone()).await else {
2276+
return Err(CondCheckError::<()>::NotYet);
2277+
};
2278+
if matches!(status, NodeStatus { .. }) {
2279+
Ok(())
2280+
} else {
2281+
Err(CondCheckError::<()>::NotYet)
2282+
}
2283+
},
2284+
&poll_interval,
2285+
&poll_max,
2286+
)
2287+
.await
2288+
.unwrap();
22742289

22752290
setup.cleanup_successful();
22762291
}

0 commit comments

Comments
 (0)