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/pull.rs | 90 ++++++++++++++++++++--------------------------------------- 1 file changed, 30 insertions(+), 60 deletions(-) (limited to 'tests/pull.rs') diff --git a/tests/pull.rs b/tests/pull.rs index ee8cad1..77ff87b 100644 --- a/tests/pull.rs +++ b/tests/pull.rs @@ -127,7 +127,10 @@ mod when_main_is_checked_out { mod cli_prompts { use super::*; - async fn run_async_cli_show_error() -> Result<()> { + + #[tokio::test] + #[serial] + async fn cli_show_error() -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -174,12 +177,6 @@ mod when_main_is_checked_out { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_show_error() -> Result<()> { - run_async_cli_show_error().await - } } } @@ -188,7 +185,10 @@ mod when_branch_doesnt_exist { mod cli_prompts { use super::*; - async fn run_async_cli_show_error() -> Result<()> { + + #[tokio::test] + #[serial] + async fn cli_show_error() -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -239,12 +239,6 @@ mod when_branch_doesnt_exist { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_show_error() -> Result<()> { - run_async_cli_show_error().await - } } } @@ -256,7 +250,9 @@ mod when_branch_is_checked_out { mod cli_prompts { use super::*; - async fn run_async_cli_show_up_to_date() -> Result<()> { + #[tokio::test] + #[serial] + async fn cli_show_up_to_date() -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -304,12 +300,6 @@ mod when_branch_is_checked_out { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_show_up_to_date() -> Result<()> { - run_async_cli_show_up_to_date().await - } } } @@ -368,7 +358,9 @@ mod when_branch_is_checked_out { mod cli_prompts { use super::*; - async fn run_async_cli_applied_1_commit() -> Result<()> { + #[tokio::test] + #[serial] + async fn cli_applied_1_commit() -> Result<()> { // fallback (51,52) user write (53, 55) repo (55, 56) let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), @@ -419,12 +411,6 @@ mod when_branch_is_checked_out { Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_applied_1_commit() -> Result<()> { - run_async_cli_applied_1_commit().await - } } #[tokio::test] @@ -444,7 +430,10 @@ mod when_branch_is_checked_out { mod cli_prompts { use super::*; - async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { + + #[tokio::test] + #[serial] + async fn cli_output_correct() -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -509,13 +498,6 @@ mod when_branch_is_checked_out { println!("{:?}", r55.events); Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_output_correct() -> Result<()> { - let _ = run_async_prompts_to_choose_from_proposal_titles().await; - Ok(()) - } } } @@ -524,7 +506,10 @@ mod when_branch_is_checked_out { mod cli_prompts { use super::*; - async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { + + #[tokio::test] + #[serial] + async fn cli_output_correct() -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -589,13 +574,6 @@ mod when_branch_is_checked_out { println!("{:?}", r55.events); Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_output_correct() -> Result<()> { - let _ = run_async_prompts_to_choose_from_proposal_titles().await; - Ok(()) - } } } @@ -659,7 +637,10 @@ mod when_branch_is_checked_out { mod cli_prompts { use super::*; - async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { + + #[tokio::test] + #[serial] + async fn prompts_to_choose_from_proposal_titles() -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -711,13 +692,6 @@ mod when_branch_is_checked_out { println!("{:?}", r55.events); Ok(()) } - - #[tokio::test] - #[serial] - async fn prompts_to_choose_from_proposal_titles() -> Result<()> { - let _ = run_async_prompts_to_choose_from_proposal_titles().await; - Ok(()) - } } #[tokio::test] @@ -835,7 +809,10 @@ mod when_branch_is_checked_out { mod cli_prompts { use super::*; - async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { + + #[tokio::test] + #[serial] + async fn prompts_to_choose_from_proposal_titles() -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -928,13 +905,6 @@ mod when_branch_is_checked_out { println!("{:?}", r55.events); Ok(()) } - - #[tokio::test] - #[serial] - async fn prompts_to_choose_from_proposal_titles() -> Result<()> { - let _ = run_async_prompts_to_choose_from_proposal_titles().await; - Ok(()) - } } #[tokio::test] -- cgit v1.2.3