Skip to content

Commit

Permalink
Add a new test
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszrzasik committed Dec 16, 2024
1 parent 766c718 commit a567617
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions crates/testing/src/overall_safety_task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ impl<TYPES: NodeType, I: TestableNodeImplementation<TYPES>, V: Versions> TestTas
self.ctx.successful_views.insert(view_number);
// if a view succeeds remove it from the failed views
self.ctx.failed_views.remove(&view_number);
tracing::error!("lrzasik: successful view: {:?}", view_number);
if self.ctx.successful_views.len() >= num_successful_views {
let _ = self.test_sender.broadcast(TestEvent::Shutdown).await;
}
Expand Down
40 changes: 39 additions & 1 deletion crates/testing/tests/tests_1/test_with_failures_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
use std::collections::HashMap;

use hotshot_example_types::{
node_types::{Libp2pImpl, MemoryImpl, PushCdnImpl, TestConsecutiveLeaderTypes, TestVersions},
node_types::{
CombinedImpl, EpochsTestVersions, Libp2pImpl, MemoryImpl, PushCdnImpl,
TestConsecutiveLeaderTypes, TestTwoStakeTablesTypes, TestVersions,
},
state_types::TestTypes,
};
use hotshot_macros::cross_tests;
Expand Down Expand Up @@ -70,6 +73,41 @@ cross_tests!(
}
);

cross_tests!(
TestName: test_with_failures_2_with_epochs,
Impls: [Libp2pImpl, PushCdnImpl, CombinedImpl],
Types: [TestTypes, TestTwoStakeTablesTypes],
Versions: [EpochsTestVersions],
Ignore: false,
Metadata: {
let mut metadata = TestDescription::default_more_nodes();
metadata.num_nodes_with_stake = 12;
metadata.da_staked_committee_size = 12;
metadata.start_nodes = 12;
let dead_nodes = vec![
ChangeNode {
idx: 10,
updown: NodeAction::Down,
},
ChangeNode {
idx: 11,
updown: NodeAction::Down,
},
];

metadata.spinning_properties = SpinningTaskDescription {
node_changes: vec![(5, dead_nodes)]
};

// 2 nodes fail triggering view sync, expect no other timeouts
metadata.overall_safety_properties.num_failed_views = 5;
// Make sure we keep committing rounds after the bad leaders, but not the full 50 because of the numerous timeouts
metadata.overall_safety_properties.num_successful_views = 20;

metadata
}
);

cross_tests!(
TestName: test_with_double_leader_failures,
Impls: [MemoryImpl, Libp2pImpl, PushCdnImpl],
Expand Down

0 comments on commit a567617

Please sign in to comment.