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/list.rs | 106 +++++++++++++++++++--------------------------------------- 1 file changed, 35 insertions(+), 71 deletions(-) (limited to 'tests/list.rs') diff --git a/tests/list.rs b/tests/list.rs index 6d161ea..7e12dc1 100644 --- a/tests/list.rs +++ b/tests/list.rs @@ -219,22 +219,19 @@ mod cannot_find_repo_event { #[tokio::test] #[serial] async fn warns_not_valid_input_and_asks_again() -> Result<()> { - let _ = run_async_repo_event_ref_needed(true, false, false).await; - Ok(()) + run_async_repo_event_ref_needed(true, false, false).await } #[tokio::test] #[serial] async fn finds_based_on_nevent_on_embeded_relay() -> Result<()> { - let _ = run_async_repo_event_ref_needed(false, true, false).await; - Ok(()) + run_async_repo_event_ref_needed(false, true, false).await } #[tokio::test] #[serial] async fn finds_based_on_naddr_on_embeded_relay() -> Result<()> { - let _ = run_async_repo_event_ref_needed(false, false, true).await; - Ok(()) + run_async_repo_event_ref_needed(false, false, true).await } } } @@ -327,7 +324,9 @@ mod when_main_branch_is_uptodate { 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), @@ -396,13 +395,6 @@ mod when_main_branch_is_uptodate { 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] @@ -517,7 +509,10 @@ mod when_main_branch_is_uptodate { 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), @@ -586,13 +581,6 @@ mod when_main_branch_is_uptodate { 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] @@ -713,7 +701,10 @@ mod when_main_branch_is_uptodate { 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), @@ -789,13 +780,6 @@ mod when_main_branch_is_uptodate { 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] @@ -922,7 +906,10 @@ mod when_main_branch_is_uptodate { 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), @@ -998,13 +985,6 @@ mod when_main_branch_is_uptodate { 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] @@ -1102,7 +1082,10 @@ mod when_main_branch_is_uptodate { 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), @@ -1176,13 +1159,6 @@ mod when_main_branch_is_uptodate { 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] @@ -1302,7 +1278,11 @@ mod when_main_branch_is_uptodate { mod cli_prompts { use super::*; - async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { + + #[tokio::test] + #[serial] + async fn out_reflects_second_choice_discarding_old_and_applying_new() + -> Result<()> { let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( Relay::new(8051, None, None), Relay::new(8052, None, None), @@ -1393,14 +1373,6 @@ mod when_main_branch_is_uptodate { println!("{:?}", r55.events); Ok(()) } - - #[tokio::test] - #[serial] - async fn out_reflects_second_choice_discarding_old_and_applying_new() - -> Result<()> { - let _ = run_async_prompts_to_choose_from_proposal_titles().await; - Ok(()) - } } #[tokio::test] @@ -1504,7 +1476,10 @@ mod when_main_branch_is_uptodate { 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), @@ -1583,13 +1558,6 @@ mod when_main_branch_is_uptodate { 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] @@ -1746,7 +1714,10 @@ mod when_main_branch_is_uptodate { 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), @@ -1866,13 +1837,6 @@ mod when_main_branch_is_uptodate { 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