diff --git a/node/core/dispute-coordinator/src/tests.rs b/node/core/dispute-coordinator/src/tests.rs index 7f970ab72ac9..0d370541a49b 100644 --- a/node/core/dispute-coordinator/src/tests.rs +++ b/node/core/dispute-coordinator/src/tests.rs @@ -55,7 +55,9 @@ use polkadot_node_subsystem::{ messages::{AllMessages, BlockDescription, RuntimeApiMessage, RuntimeApiRequest}, ActivatedLeaf, ActiveLeavesUpdate, LeafStatus, }; -use polkadot_node_subsystem_test_helpers::{make_subsystem_context, TestSubsystemContextHandle}; +use polkadot_node_subsystem_test_helpers::{ + make_buffered_subsystem_context, TestSubsystemContextHandle, +}; use polkadot_primitives::v2::{ ApprovalVote, BlockNumber, CandidateCommitments, CandidateEvent, CandidateHash, CandidateReceipt, CoreIndex, DisputeStatement, GroupIndex, Hash, HeadData, Header, IndexedVec, @@ -523,7 +525,7 @@ impl TestState { F: FnOnce(TestState, VirtualOverseer) -> BoxFuture<'static, TestState>, { self.known_session = None; - let (ctx, ctx_handle) = make_subsystem_context(TaskExecutor::new()); + let (ctx, ctx_handle) = make_buffered_subsystem_context(TaskExecutor::new(), 1); let subsystem = DisputeCoordinatorSubsystem::new( self.db.clone(), self.config.clone(), diff --git a/node/subsystem-test-helpers/src/lib.rs b/node/subsystem-test-helpers/src/lib.rs index 30ab5c830c2a..0eca49f0924b 100644 --- a/node/subsystem-test-helpers/src/lib.rs +++ b/node/subsystem-test-helpers/src/lib.rs @@ -280,11 +280,19 @@ impl TestSubsystemContextHandle { } } -/// Make a test subsystem context. +/// Make a test subsystem context with `buffer_size == 0`. pub fn make_subsystem_context( spawner: S, ) -> (TestSubsystemContext>, TestSubsystemContextHandle) { - let (overseer_tx, overseer_rx) = mpsc::channel(1); + make_buffered_subsystem_context(spawner, 0) +} + +/// Make a test subsystem context. +pub fn make_buffered_subsystem_context( + spawner: S, + buffer_size: usize, +) -> (TestSubsystemContext>, TestSubsystemContextHandle) { + let (overseer_tx, overseer_rx) = mpsc::channel(buffer_size); let (all_messages_tx, all_messages_rx) = mpsc::unbounded(); ( @@ -296,7 +304,6 @@ pub fn make_subsystem_context( TestSubsystemContextHandle { tx: overseer_tx, rx: all_messages_rx }, ) } - /// Test a subsystem, mocking the overseer /// /// Pass in two async closures: one mocks the overseer, the other runs the test from the perspective of a subsystem.