From 564e95e0749de33f5c931f6d47b17d3c8dd8faf2 Mon Sep 17 00:00:00 2001 From: ss-es <155648797+ss-es@users.noreply.github.com> Date: Wed, 2 Oct 2024 11:34:41 -0400 Subject: [PATCH] Rebalance CI tests (#3718) --- .github/workflows/build-and-test.yml | 2 +- .../testing/tests/tests_3/byzantine_tests.rs | 50 +-------------- .../testing/tests/tests_4/byzantine_tests.rs | 61 +++++++++++++++++++ .../tests/{tests_2 => tests_5}/push_cdn.rs | 0 .../test_with_failures.rs} | 0 5 files changed, 64 insertions(+), 49 deletions(-) create mode 100644 crates/testing/tests/tests_4/byzantine_tests.rs rename crates/testing/tests/{tests_2 => tests_5}/push_cdn.rs (100%) rename crates/testing/tests/{tests_2/test_with_failures_one.rs => tests_5/test_with_failures.rs} (100%) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 5954049a69..e5d0a76ccf 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -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: | diff --git a/crates/testing/tests/tests_3/byzantine_tests.rs b/crates/testing/tests/tests_3/byzantine_tests.rs index 8eb6364c75..4687d3ff66 100644 --- a/crates/testing/tests/tests_3/byzantine_tests.rs +++ b/crates/testing/tests/tests_3/byzantine_tests.rs @@ -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}, @@ -30,6 +30,7 @@ use hotshot_types::{ }, vote::HasViewNumber, }; + cross_tests!( TestName: double_propose_vote, Impls: [MemoryImpl], @@ -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], diff --git a/crates/testing/tests/tests_4/byzantine_tests.rs b/crates/testing/tests/tests_4/byzantine_tests.rs new file mode 100644 index 0000000000..8b460a5665 --- /dev/null +++ b/crates/testing/tests/tests_4/byzantine_tests.rs @@ -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 + }, +); diff --git a/crates/testing/tests/tests_2/push_cdn.rs b/crates/testing/tests/tests_5/push_cdn.rs similarity index 100% rename from crates/testing/tests/tests_2/push_cdn.rs rename to crates/testing/tests/tests_5/push_cdn.rs diff --git a/crates/testing/tests/tests_2/test_with_failures_one.rs b/crates/testing/tests/tests_5/test_with_failures.rs similarity index 100% rename from crates/testing/tests/tests_2/test_with_failures_one.rs rename to crates/testing/tests/tests_5/test_with_failures.rs