Skip to content

Commit

Permalink
Rebalance CI tests (#3718)
Browse files Browse the repository at this point in the history
  • Loading branch information
ss-es authored Oct 2, 2024
1 parent b920e17 commit 564e95e
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 49 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
shared-key: "test"
prefix-key: ${{ matrix.just_variants }}
cache-on-failure: "true"
save-if: ${{ github.ref == 'refs/heads/main' && matrix.test_suites == 'test-ci-rest' }}
save-if: "false"

- name: Install Just
run: |
Expand Down
50 changes: 2 additions & 48 deletions crates/testing/tests/tests_3/byzantine_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use hotshot_testing::{
block_builder::SimpleBuilderImplementation,
byzantine::byzantine_behaviour::{
BadProposalViewDos, DishonestDa, DishonestLeader, DishonestVoter, DishonestVoting,
DoubleProposeVote, ViewDelay,
DoubleProposeVote,
},
completion_task::{CompletionTaskDescription, TimeBasedCompletionTaskDescription},
test_builder::{Behaviour, TestDescription},
Expand All @@ -30,6 +30,7 @@ use hotshot_types::{
},
vote::HasViewNumber,
};

cross_tests!(
TestName: double_propose_vote,
Impls: [MemoryImpl],
Expand Down Expand Up @@ -162,53 +163,6 @@ cross_tests!(
},
);

cross_tests!(
TestName: view_delay,
Impls: [MemoryImpl, Libp2pImpl, PushCdnImpl],
Types: [TestTypes],
Versions: [MarketplaceTestVersions],
Ignore: false,
Metadata: {

let behaviour = Rc::new(|node_id| {
let view_delay = ViewDelay {
number_of_views_to_delay: node_id/3,
events_for_view: HashMap::new(),
stop_view_delay_at_view_number: 25,
};
match node_id {
6|10|14 => Behaviour::Byzantine(Box::new(view_delay)),
_ => Behaviour::Standard,
}
});

let mut metadata = TestDescription {
// allow more time to pass in CI
completion_task_description: CompletionTaskDescription::TimeBasedCompletionTaskBuilder(
TimeBasedCompletionTaskDescription {
duration: Duration::from_secs(60),
},
),
behaviour,
..TestDescription::default()
};

let num_nodes_with_stake = 15;
metadata.num_nodes_with_stake = num_nodes_with_stake;
metadata.da_staked_committee_size = num_nodes_with_stake;
metadata.overall_safety_properties.num_failed_views = 20;
metadata.overall_safety_properties.num_successful_views = 20;
metadata.overall_safety_properties.expected_views_to_fail = HashMap::from([
(ViewNumber::new(6), false),
(ViewNumber::new(10), false),
(ViewNumber::new(14), false),
(ViewNumber::new(21), false),
(ViewNumber::new(25), false),
]);
metadata
},
);

cross_tests!(
TestName: dishonest_voting,
Impls: [MemoryImpl, Libp2pImpl, PushCdnImpl],
Expand Down
61 changes: 61 additions & 0 deletions crates/testing/tests/tests_4/byzantine_tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
use std::{collections::HashMap, rc::Rc, time::Duration};

use hotshot_example_types::{
node_types::{Libp2pImpl, MarketplaceTestVersions, MemoryImpl, PushCdnImpl},
state_types::TestTypes,
};
use hotshot_macros::cross_tests;
use hotshot_testing::{
block_builder::SimpleBuilderImplementation,
byzantine::byzantine_behaviour::ViewDelay,
completion_task::{CompletionTaskDescription, TimeBasedCompletionTaskDescription},
test_builder::{Behaviour, TestDescription},
};
use hotshot_types::{data::ViewNumber, traits::node_implementation::ConsensusTime};

cross_tests!(
TestName: view_delay,
Impls: [MemoryImpl, Libp2pImpl, PushCdnImpl],
Types: [TestTypes],
Versions: [MarketplaceTestVersions],
Ignore: false,
Metadata: {

let behaviour = Rc::new(|node_id| {
let view_delay = ViewDelay {
number_of_views_to_delay: node_id/3,
events_for_view: HashMap::new(),
stop_view_delay_at_view_number: 25,
};
match node_id {
6|10|14 => Behaviour::Byzantine(Box::new(view_delay)),
_ => Behaviour::Standard,
}
});

let mut metadata = TestDescription {
// allow more time to pass in CI
completion_task_description: CompletionTaskDescription::TimeBasedCompletionTaskBuilder(
TimeBasedCompletionTaskDescription {
duration: Duration::from_secs(60),
},
),
behaviour,
..TestDescription::default()
};

let num_nodes_with_stake = 15;
metadata.num_nodes_with_stake = num_nodes_with_stake;
metadata.da_staked_committee_size = num_nodes_with_stake;
metadata.overall_safety_properties.num_failed_views = 20;
metadata.overall_safety_properties.num_successful_views = 20;
metadata.overall_safety_properties.expected_views_to_fail = HashMap::from([
(ViewNumber::new(6), false),
(ViewNumber::new(10), false),
(ViewNumber::new(14), false),
(ViewNumber::new(21), false),
(ViewNumber::new(25), false),
]);
metadata
},
);
File renamed without changes.

0 comments on commit 564e95e

Please sign in to comment.