From 7adada58eb04c40219e49d8678b99e077f327e4a Mon Sep 17 00:00:00 2001 From: Cameron Garnham Date: Tue, 5 Sep 2023 22:24:10 +0200 Subject: [PATCH] dev: add should_panic expected message to tracker tests --- src/servers/udp/connection_cookie.rs | 2 +- src/tracker/peer.rs | 8 ++++---- tests/servers/api/v1/contract/configuration.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/servers/udp/connection_cookie.rs b/src/servers/udp/connection_cookie.rs index a389388a7..4dc9896ab 100644 --- a/src/servers/udp/connection_cookie.rs +++ b/src/servers/udp/connection_cookie.rs @@ -314,7 +314,7 @@ mod tests { } #[test] - #[should_panic] + #[should_panic = "InvalidConnectionId"] fn it_should_be_not_valid_after_their_last_time_extent() { let remote_address = SocketAddr::new(IpAddr::V4(Ipv4Addr::UNSPECIFIED), 0); diff --git a/src/tracker/peer.rs b/src/tracker/peer.rs index 76747fea2..de9bacc10 100644 --- a/src/tracker/peer.rs +++ b/src/tracker/peer.rs @@ -363,14 +363,14 @@ mod test { } #[test] - #[should_panic] + #[should_panic = "assertion `left == right` failed"] fn should_fail_trying_to_instantiate_from_a_byte_slice_with_less_than_20_bytes() { let less_than_20_bytes = [0; 19]; let _: peer::Id = peer::Id::from_bytes(&less_than_20_bytes); } #[test] - #[should_panic] + #[should_panic = "assertion `left == right` failed"] fn should_fail_trying_to_instantiate_from_a_byte_slice_with_more_than_20_bytes() { let more_than_20_bytes = [0; 21]; let _: peer::Id = peer::Id::from_bytes(&more_than_20_bytes); @@ -418,13 +418,13 @@ mod test { } #[test] - #[should_panic] + #[should_panic = "NotEnoughBytes"] fn should_fail_trying_to_convert_from_a_byte_vector_with_less_than_20_bytes() { let _: peer::Id = peer::Id::try_from([0; 19].to_vec()).unwrap(); } #[test] - #[should_panic] + #[should_panic = "TooManyBytes"] fn should_fail_trying_to_convert_from_a_byte_vector_with_more_than_20_bytes() { let _: peer::Id = peer::Id::try_from([0; 21].to_vec()).unwrap(); } diff --git a/tests/servers/api/v1/contract/configuration.rs b/tests/servers/api/v1/contract/configuration.rs index e4b608607..9ed257c51 100644 --- a/tests/servers/api/v1/contract/configuration.rs +++ b/tests/servers/api/v1/contract/configuration.rs @@ -3,7 +3,7 @@ use torrust_tracker_test_helpers::configuration; use crate::servers::api::test_environment::stopped_test_environment; #[tokio::test] -#[should_panic] +#[should_panic = "Could not receive bind_address."] async fn should_fail_with_ssl_enabled_and_bad_ssl_config() { let mut test_env = stopped_test_environment(configuration::ephemeral());