diff --git a/chitchat/tests/cluster_test.rs b/chitchat/tests/cluster_test.rs index a41906d..50b371c 100644 --- a/chitchat/tests/cluster_test.rs +++ b/chitchat/tests/cluster_test.rs @@ -388,8 +388,15 @@ async fn test_marked_for_deletion_gc_with_network_partition() { predicate: NodeStatePredicate::MarkedForDeletion("key_a".to_string(), false), timeout_opt: None, }, - // Wait for garbage collection: grace period * heartbeat ~ 1 second + margin of 1 second. - Operation::Wait(Duration::from_secs(2)), + // Add node 4 which communicates only with node 3. + Operation::RemoveNetworkLink(chitchat_id_1.clone(), chitchat_id_4.clone()), + Operation::RemoveNetworkLink(chitchat_id_2.clone(), chitchat_id_4.clone()), + Operation::AddNode { + chitchat_id: chitchat_id_4.clone(), + peer_seeds: Some(vec![chitchat_id_3.clone()]), + }, + // Wait for garbage collection: grace period * heartbeat ~ 1 second + margin of 1 heartbeat. + Operation::Wait(Duration::from_millis(1100)), Operation::NodeStateAssert { server_chitchat_id: chitchat_id_2.clone(), chitchat_id: chitchat_id_1.clone(), @@ -402,16 +409,7 @@ async fn test_marked_for_deletion_gc_with_network_partition() { predicate: NodeStatePredicate::KeyPresent("key_a".to_string(), false), timeout_opt: None, }, - // Add node 4 which communicates only with node 3. - Operation::RemoveNetworkLink(chitchat_id_1.clone(), chitchat_id_4.clone()), - Operation::RemoveNetworkLink(chitchat_id_2.clone(), chitchat_id_4.clone()), - Operation::AddNode { - chitchat_id: chitchat_id_4.clone(), - peer_seeds: Some(vec![chitchat_id_3.clone()]), - }, - // Wait for propagation - // We need to wait longer... because node 4 is just starting? - Operation::Wait(Duration::from_millis(500)), + // node 3 and 4 don't know about the deletion, but node 4 learned of key_a through node 3 Operation::NodeStateAssert { server_chitchat_id: chitchat_id_3.clone(), chitchat_id: chitchat_id_1.clone(), @@ -424,9 +422,15 @@ async fn test_marked_for_deletion_gc_with_network_partition() { predicate: NodeStatePredicate::KeyPresent("key_a".to_string(), true), timeout_opt: None, }, - // Relink node 3 + // Relink node 3 to 1 and 2 Operation::AddNetworkLink(chitchat_id_1.clone(), chitchat_id_3.clone()), - Operation::AddNetworkLink(chitchat_id_1.clone(), chitchat_id_2.clone()), + Operation::AddNetworkLink(chitchat_id_2.clone(), chitchat_id_3.clone()), + // TODO test break here. It seems node 3 receive news from node 1 that the max_version is a + // missmatch. It asks why, and node 1 unhelfully reply nothing (it no longer has a + // tombstone for the item node 3 knows about) + // it's unclear why it worked before. + // (other changes to these tests were made because node 3 would end up thinking node 1 was + // dead, and not transmit its informations to node 4) Operation::NodeStateAssert { server_chitchat_id: chitchat_id_3.clone(), chitchat_id: chitchat_id_1.clone(),