diff --git a/node/subsystem-util/src/rolling_session_window.rs b/node/subsystem-util/src/rolling_session_window.rs index d8a908a6901c..608ae420b0b5 100644 --- a/node/subsystem-util/src/rolling_session_window.rs +++ b/node/subsystem-util/src/rolling_session_window.rs @@ -281,6 +281,7 @@ mod tests { use assert_matches::assert_matches; use polkadot_node_subsystem::messages::{AllMessages, AvailabilityRecoveryMessage}; use polkadot_node_subsystem_test_helpers::make_subsystem_context; + use polkadot_node_subsystem::SubsystemContext; use polkadot_primitives::v2::Header; use sp_core::testing::TaskExecutor; @@ -329,11 +330,11 @@ mod tests { let test_fut = { Box::pin(async move { let window = match window { - None => RollingSessionWindow::new(&mut sender, TEST_WINDOW_SIZE, hash) + None => RollingSessionWindow::new(sender.clone(), TEST_WINDOW_SIZE, hash) .await .unwrap(), Some(mut window) => { - window.cache_session_info_for_head(&mut sender, hash).await.unwrap(); + window.cache_session_info_for_head(sender, hash).await.unwrap(); window }, }; @@ -503,8 +504,9 @@ mod tests { let hash = header.hash(); let test_fut = { + let sender = ctx.sender().clone(); Box::pin(async move { - let res = RollingSessionWindow::new(ctx.sender(), TEST_WINDOW_SIZE, hash).await; + let res = RollingSessionWindow::new(sender, TEST_WINDOW_SIZE, hash).await; assert!(res.is_err()); }) }; @@ -563,8 +565,9 @@ mod tests { let test_fut = { Box::pin(async move { + let sender = ctx.sender().clone(); let window = - RollingSessionWindow::new(ctx.sender(), TEST_WINDOW_SIZE, hash).await.unwrap(); + RollingSessionWindow::new(sender, TEST_WINDOW_SIZE, hash).await.unwrap(); assert_eq!(window.earliest_session, session); assert_eq!(window.session_info, vec![dummy_session_info(session)]); diff --git a/node/subsystem-util/src/tests.rs b/node/subsystem-util/src/tests.rs index 12c9e21220d2..34dd647932d2 100644 --- a/node/subsystem-util/src/tests.rs +++ b/node/subsystem-util/src/tests.rs @@ -61,6 +61,7 @@ enum Error { impl JobTrait for FakeCollatorProtocolJob where Sender: overseer::CollatorProtocolSenderTrait + std::marker::Unpin, + JobSender: overseer::CollatorProtocolSenderTrait + std::marker::Unpin, { type ToJob = CollatorProtocolMessage; type OutgoingMessages = overseer::CollatorProtocolOutgoingMessages; @@ -86,12 +87,16 @@ where FakeCollatorProtocolJob { receiver, _phantom: std::marker::PhantomData:: }; if run_args { - sender - .send_message(CollatorProtocolMessage::Invalid( - dummy_hash(), - dummy_candidate_receipt(dummy_hash()), - )) - .await; + // FIXME XXX + // this was a hack for testing, for sending a message to a subsystem itself + // on a bounded channel which is outragiously stupid, even for a test case + // sender + // .send_message(CollatorProtocolMessage::Invalid( + // dummy_hash(), + // dummy_candidate_receipt(dummy_hash()), + // )) + // .await; + unimplemented!("Probably delete this testcase entirely TODO") } // it isn't necessary to break run_loop into its own function,