From 45f70a4c52614d79a207e05e21b1c6b8e75fc8f1 Mon Sep 17 00:00:00 2001 From: Brendon Fish Date: Wed, 11 Sep 2024 13:34:14 -0400 Subject: [PATCH] Bf/restart tune (#3668) * actually restart all nodes in restart tests * saturating sub * lint --- crates/testing/src/overall_safety_task.rs | 9 ++++++--- crates/testing/tests/tests_2/catchup.rs | 12 ++++-------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/crates/testing/src/overall_safety_task.rs b/crates/testing/src/overall_safety_task.rs index a4680d5000..5aac9086d3 100644 --- a/crates/testing/src/overall_safety_task.rs +++ b/crates/testing/src/overall_safety_task.rs @@ -249,9 +249,12 @@ impl, V: Versions> TestTas expected_views_to_fail, }: OverallSafetyPropertiesDescription = self.properties.clone(); - let num_incomplete_views = self.ctx.round_results.len() - - self.ctx.successful_views.len() - - self.ctx.failed_views.len(); + let num_incomplete_views = self + .ctx + .round_results + .len() + .saturating_sub(self.ctx.successful_views.len()) + .saturating_sub(self.ctx.failed_views.len()); if self.ctx.successful_views.len() < num_successful_views { return TestResult::Fail(Box::new(OverallSafetyTaskErr::::NotEnoughDecides { diff --git a/crates/testing/tests/tests_2/catchup.rs b/crates/testing/tests/tests_2/catchup.rs index e0b79f7302..16d7e530ea 100644 --- a/crates/testing/tests/tests_2/catchup.rs +++ b/crates/testing/tests/tests_2/catchup.rs @@ -322,7 +322,7 @@ async fn test_all_restart() { let mut metadata: TestDescription = TestDescription::default(); let mut catchup_nodes = vec![]; - for i in 1..20 { + for i in 0..20 { catchup_nodes.push(ChangeNode { idx: i, updown: UpDown::Restart, @@ -384,7 +384,7 @@ async fn test_all_restart_cdn() { let mut metadata: TestDescription = TestDescription::default(); let mut catchup_nodes = vec![]; - for i in 1..20 { + for i in 0..20 { catchup_nodes.push(ChangeNode { idx: i, updown: UpDown::Restart, @@ -450,12 +450,8 @@ async fn test_all_restart_one_da() { let mut metadata: TestDescription = TestDescription::default(); - let node_0_down = vec![ChangeNode { - idx: 0, - updown: UpDown::Restart, - }]; let mut catchup_nodes = vec![]; - for i in 1..20 { + for i in 0..20 { catchup_nodes.push(ChangeNode { idx: i, updown: UpDown::Restart, @@ -471,7 +467,7 @@ async fn test_all_restart_one_da() { metadata.spinning_properties = SpinningTaskDescription { // Restart all the nodes in view 13 - node_changes: vec![(12, node_0_down), (13, catchup_nodes)], + node_changes: vec![(13, catchup_nodes)], }; metadata.view_sync_properties = hotshot_testing::view_sync_task::ViewSyncTaskDescription::Threshold(0, 20);