diff --git a/roles/tests-integration/lib/sniffer.rs b/roles/tests-integration/lib/sniffer.rs index 14711ba7b7..3953191d50 100644 --- a/roles/tests-integration/lib/sniffer.rs +++ b/roles/tests-integration/lib/sniffer.rs @@ -31,7 +31,6 @@ type MsgType = u8; enum SnifferError { DownstreamClosed, UpstreamClosed, - MessageInterrupted, } /// Allows to intercept messages sent between two roles. @@ -49,9 +48,6 @@ enum SnifferError { /// specified [`InterceptMessage::direction`] and replace it with /// [`InterceptMessage::replacement_message`]. /// -/// If `break_on` is set to `true`, the [`Sniffer`] will stop the communication after sending the -/// new message. -/// /// Can be useful for testing purposes, as it allows to assert that the roles have sent specific /// messages in a specific order and to inspect the messages details. #[derive(Debug, Clone)] @@ -71,7 +67,6 @@ pub struct InterceptMessage { expected_message_type: MsgType, replacement_message: PoolMessages<'static>, replacement_message_type: MsgType, - break_on: bool, } impl InterceptMessage { @@ -80,14 +75,12 @@ impl InterceptMessage { expected_message_type: MsgType, replacement_message: PoolMessages<'static>, replacement_message_type: MsgType, - break_on: bool, ) -> Self { Self { direction, expected_message_type, replacement_message, replacement_message_type, - break_on, } } } @@ -244,11 +237,6 @@ impl Sniffer { downstream_messages .add_message(msg_type, intercept_message.replacement_message.clone()); let _ = send.send(frame).await; - if intercept_message.break_on { - return Err(SnifferError::MessageInterrupted); - } else { - continue; - } } } @@ -286,11 +274,6 @@ impl Sniffer { upstream_messages .add_message(msg_type, intercept_message.replacement_message.clone()); let _ = send.send(frame).await; - if intercept_message.break_on { - return Err(SnifferError::MessageInterrupted); - } else { - continue; - } } } if send.send(frame).await.is_err() { diff --git a/roles/tests-integration/tests/sniffer_integration.rs b/roles/tests-integration/tests/sniffer_integration.rs index 64eeaf649f..7cd812c854 100644 --- a/roles/tests-integration/tests/sniffer_integration.rs +++ b/roles/tests-integration/tests/sniffer_integration.rs @@ -8,10 +8,10 @@ use sniffer::{InterceptMessage, MessageDirection}; use std::convert::TryInto; #[tokio::test] -async fn test_sniffer_interrupter() { +async fn test_sniffer_intercept() { let (_tp, tp_addr) = start_template_provider(None).await; use const_sv2::MESSAGE_TYPE_SETUP_CONNECTION_SUCCESS; - let message = + let message_replacement = PoolMessages::Common(CommonMessages::SetupConnectionError(SetupConnectionError { flags: 0, error_code: "unsupported-feature-flags" @@ -20,15 +20,14 @@ async fn test_sniffer_interrupter() { .try_into() .unwrap(), })); - let interrupt_msgs = InterceptMessage::new( + let intercept = InterceptMessage::new( MessageDirection::ToDownstream, MESSAGE_TYPE_SETUP_CONNECTION_SUCCESS, - message, + message_replacement, MESSAGE_TYPE_SETUP_CONNECTION_ERROR, - true, ); let (sniffer, sniffer_addr) = - start_sniffer("".to_string(), tp_addr, false, Some(vec![interrupt_msgs])).await; + start_sniffer("".to_string(), tp_addr, false, Some(vec![intercept])).await; let _ = start_pool(Some(sniffer_addr)).await; assert_common_message!(&sniffer.next_message_from_downstream(), SetupConnection); assert_common_message!(&sniffer.next_message_from_upstream(), SetupConnectionError);