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/push.rs | 69 +++++++++++++++++++---------------------------------------- 1 file changed, 22 insertions(+), 47 deletions(-) (limited to 'tests/push.rs') diff --git a/tests/push.rs b/tests/push.rs index d295c01..db7a8b8 100644 --- a/tests/push.rs +++ b/tests/push.rs @@ -112,7 +112,10 @@ mod when_proposal_isnt_associated_with_branch_name { 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), @@ -163,12 +166,6 @@ mod when_proposal_isnt_associated_with_branch_name { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_show_error() -> Result<()> { - run_async_cli_show_error().await - } } } @@ -180,7 +177,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), @@ -228,13 +227,6 @@ mod when_branch_is_checked_out { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_show_up_to_date() -> Result<()> { - let _ = run_async_cli_show_up_to_date().await; - Ok(()) - } } } @@ -243,7 +235,10 @@ mod when_branch_is_checked_out { mod cli_prompts { use super::*; - async fn run_async_cli_shows_proposal_ahead_error() -> Result<()> { + + #[tokio::test] + #[serial] + async fn cli_show_proposal_ahead_error() -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -291,13 +286,6 @@ mod when_branch_is_checked_out { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_show_proposal_ahead_error() -> Result<()> { - let _ = run_async_cli_shows_proposal_ahead_error().await; - Ok(()) - } } } @@ -309,7 +297,9 @@ mod when_branch_is_checked_out { 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), @@ -392,13 +382,6 @@ mod when_branch_is_checked_out { Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_applied_1_commit() -> Result<()> { - let _ = run_async_cli_applied_1_commit().await; - Ok(()) - } } async fn prep_and_run() -> Result<(GitTestRepo, Vec)> { @@ -480,7 +463,10 @@ mod when_branch_is_checked_out { mod cli_prompts { use super::*; - async fn run_async_cli_shows_unpublished_rebase_error() -> Result<()> { + + #[tokio::test] + #[serial] + async fn cli_shows_unpublished_rebase_error() -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -533,20 +519,16 @@ mod when_branch_is_checked_out { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_shows_unpublished_rebase_error() -> Result<()> { - let _ = run_async_cli_shows_unpublished_rebase_error().await; - Ok(()) - } } mod with_force_flag { use super::*; mod cli_prompts { use super::*; - async fn run_async_cli_shows_revision_sent() -> Result<()> { + + #[tokio::test] + #[serial] + async fn cli_shows_revision_sent() -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -633,13 +615,6 @@ mod when_branch_is_checked_out { cli_tester_handle.join().unwrap()?; Ok(()) } - - #[tokio::test] - #[serial] - async fn cli_shows_revision_sent() -> Result<()> { - let _ = run_async_cli_shows_revision_sent().await; - Ok(()) - } } } } -- cgit v1.2.3