From b02b4754c027bd751825c8e3b96766a5898187b1 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Mon, 4 Mar 2024 10:54:38 +0000 Subject: test: ensure failed tests timeout resolve a long standing test issue where failures to output the correct message in the cli would result in the test never ending rather than failing the many test cases updated in this change are to ensure failures are caught rather than ignored some of them are just refactored to remove calling an extra function, which is no longer needed note: this doesn't fix the intermittent issue, most commonly experienced under the nix configuration, where tests that should pass occationally never end preventing the rest of the suite from running --- tests/send.rs | 77 ++++++++++++++++------------------------------------------- 1 file changed, 21 insertions(+), 56 deletions(-) (limited to 'tests/send.rs') diff --git a/tests/send.rs b/tests/send.rs index 4e1adf4..3c619a4 100644 --- a/tests/send.rs +++ b/tests/send.rs @@ -696,7 +696,9 @@ mod sends_cover_letter_and_2_patches_to_3_relays { mod cli_ouput { use super::*; - async fn run_test_async() -> Result<()> { + #[tokio::test] + #[serial] + async fn check_cli_output() -> Result<()> { let git_repo = prep_git_repo()?; let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( @@ -765,13 +767,6 @@ mod sends_cover_letter_and_2_patches_to_3_relays { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn check_cli_output() -> Result<()> { - run_test_async().await?; - Ok(()) - } } mod first_event_rejected_by_1_relay { @@ -780,7 +775,9 @@ mod sends_cover_letter_and_2_patches_to_3_relays { mod only_first_rejected_event_sent_to_relay { use super::*; - async fn run_test_async() -> Result<()> { + #[tokio::test] + #[serial] + async fn only_first_rejected_event_sent_to_relay() -> Result<()> { let git_repo = prep_git_repo()?; let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( @@ -847,19 +844,14 @@ mod sends_cover_letter_and_2_patches_to_3_relays { Ok(()) } - - #[tokio::test] - #[serial] - async fn only_first_rejected_event_sent_to_relay() -> Result<()> { - run_test_async().await?; - Ok(()) - } } mod cli_show_rejection_with_comment { use super::*; - async fn run_test_async() -> Result<(Relay<'static>, Relay<'static>, Relay<'static>)> { + #[tokio::test] + #[serial] + async fn cli_show_rejection_with_comment() -> Result<()> { let git_repo = prep_git_repo()?; let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( @@ -939,13 +931,6 @@ mod sends_cover_letter_and_2_patches_to_3_relays { r56.listen_until_close(), ); cli_tester_handle.join().unwrap()?; - Ok((r51, r52, r53)) - } - - #[tokio::test] - #[serial] - async fn cli_show_rejection_with_comment() -> Result<()> { - run_test_async().await?; Ok(()) } } @@ -958,7 +943,9 @@ mod sends_2_patches_without_cover_letter { mod cli_ouput { use super::*; - async fn run_test_async() -> Result<()> { + #[tokio::test] + #[serial] + async fn check_cli_output() -> Result<()> { let git_repo = prep_git_repo()?; let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( @@ -1028,13 +1015,6 @@ mod sends_2_patches_without_cover_letter { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn check_cli_output() -> Result<()> { - run_test_async().await?; - Ok(()) - } } #[tokio::test] @@ -1239,7 +1219,9 @@ mod when_on_main_branch_defaults_to_last_commit { mod cli_ouput { use super::*; - async fn run_test_async() -> Result<()> { + #[tokio::test] + #[serial] + async fn check_cli_output() -> Result<()> { let git_repo = prep_git_repo()?; let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( @@ -1309,13 +1291,6 @@ mod when_on_main_branch_defaults_to_last_commit { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn check_cli_output() -> Result<()> { - run_test_async().await?; - Ok(()) - } } #[tokio::test] @@ -1431,7 +1406,9 @@ mod specify_starting_commits_whist_on_main_branch { mod cli_ouput { use super::*; - async fn run_test_async() -> Result<()> { + #[tokio::test] + #[serial] + async fn check_cli_output() -> Result<()> { let git_repo = prep_git_repo()?; let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( @@ -1501,13 +1478,6 @@ mod specify_starting_commits_whist_on_main_branch { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn check_cli_output() -> Result<()> { - run_test_async().await?; - Ok(()) - } } #[tokio::test] @@ -1691,7 +1661,9 @@ mod specify_in_reply_to { mod cli_ouput { use super::*; - async fn run_test_async() -> Result<()> { + #[tokio::test] + #[serial] + async fn check_cli_output() -> Result<()> { let git_repo = prep_git_repo()?; let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( @@ -1761,13 +1733,6 @@ mod specify_in_reply_to { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn check_cli_output() -> Result<()> { - run_test_async().await?; - Ok(()) - } } mod cover_letter_tags { -- cgit v1.2.3