diff --git a/tests/tests/membership/t11_add_learner.rs b/tests/tests/membership/t11_add_learner.rs index 3dac3bf56..8be5ba0f0 100644 --- a/tests/tests/membership/t11_add_learner.rs +++ b/tests/tests/membership/t11_add_learner.rs @@ -181,11 +181,13 @@ async fn add_learner_with_set_nodes() -> Result<()> { let raft = router.get_raft_handle(&0)?; raft.change_membership(ChangeMembers::SetNodes(btreemap! {2=>(), 4=>()}), true).await?; - // TODO: Flaky: there is chance that the log is committed but metrics is not updated. - // Because metrics is updated in the next loop in the `runtime_loop` - let metrics = router.get_raft_handle(&0)?.metrics().borrow().clone(); - let node_ids = metrics.membership_config.membership().nodes().map(|x| *x.0).collect::>(); - assert_eq!(vec![0, 1, 2, 4], node_ids); + router + .wait(&0, timeout()) + .metrics( + |m| m.membership_config.membership().nodes().map(|x| *x.0).collect::>() == vec![0, 1, 2, 4], + "set node 2 and 4", + ) + .await?; } Ok(())