Skip to content

Commit

Permalink
test: enhance flaky test disk_snap::test_conf_change (#16785)
Browse files Browse the repository at this point in the history
ref #15990

Enhance unittest disk_snap::test_conf_change by add a timeout to allow async_remove_peer wait for raft replication ready.

Signed-off-by: glorv <glorvs@163.com>

Co-authored-by: ti-chi-bot[bot] <108142056+ti-chi-bot[bot]@users.noreply.github.com>
  • Loading branch information
glorv and ti-chi-bot[bot] committed Apr 10, 2024
1 parent d5e1ce6 commit cc1376f
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/integrations/backup/disk_snap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ fn test_conf_change() {
let mut suite = Suite::new(4);
let the_region = suite.cluster.get_region(b"");
let last_peer = the_region.peers.last().unwrap();
let res = block_on(
suite
.cluster
.async_remove_peer(the_region.get_id(), last_peer.clone())
.unwrap(),
);
assert_success(&res);
eventually(Duration::from_millis(200), Duration::from_secs(2), || {
let res = block_on(
suite
.cluster
.async_remove_peer(the_region.get_id(), last_peer.clone())
.unwrap(),
);
!res.get_header().has_error()
});
eventually(Duration::from_millis(100), Duration::from_secs(2), || {
let r = suite.cluster.get_region(b"");
!r.peers.iter().any(|p| p.id == last_peer.id)
Expand Down

0 comments on commit cc1376f

Please sign in to comment.