Skip to content

Commit

Permalink
Bf/restart tune (#3668)
Browse files Browse the repository at this point in the history
* actually restart all nodes in restart tests

* saturating sub

* lint
  • Loading branch information
bfish713 authored Sep 11, 2024
1 parent d9a494a commit 45f70a4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
9 changes: 6 additions & 3 deletions crates/testing/src/overall_safety_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,12 @@ impl<TYPES: NodeType, I: TestableNodeImplementation<TYPES>, V: Versions> TestTas
expected_views_to_fail,
}: OverallSafetyPropertiesDescription<TYPES> = 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::<TYPES>::NotEnoughDecides {
Expand Down
12 changes: 4 additions & 8 deletions crates/testing/tests/tests_2/catchup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ async fn test_all_restart() {
let mut metadata: TestDescription<TestTypes, CombinedImpl, TestVersions> =
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,
Expand Down Expand Up @@ -384,7 +384,7 @@ async fn test_all_restart_cdn() {
let mut metadata: TestDescription<TestTypes, PushCdnImpl, TestVersions> =
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,
Expand Down Expand Up @@ -450,12 +450,8 @@ async fn test_all_restart_one_da() {
let mut metadata: TestDescription<TestTypes, CombinedImpl, TestVersions> =
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,
Expand All @@ -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);
Expand Down

0 comments on commit 45f70a4

Please sign in to comment.