diff --git a/crates/repo-actor/src/tests/handlers/validate_repo.rs b/crates/repo-actor/src/tests/handlers/validate_repo.rs index 984a2366..c058cd7e 100644 --- a/crates/repo-actor/src/tests/handlers/validate_repo.rs +++ b/crates/repo-actor/src/tests/handlers/validate_repo.rs @@ -43,12 +43,7 @@ async fn repo_with_next_not_an_ancestor_of_dev_should_be_reset() -> TestResult { System::current().stop(); //then - tracing::debug!(?log, ""); - log.read().map_err(|e| e.to_string()).map(|l| { - assert!(l - .iter() - .any(|message| message.contains("NextBranchResetRequired"))) - })?; + log.require_message_containing("NextBranchResetRequired")?; Ok(()) } @@ -94,12 +89,7 @@ async fn repo_with_next_not_on_or_near_main_should_be_reset() -> TestResult { System::current().stop(); //then - tracing::debug!(?log, ""); - log.read().map_err(|e| e.to_string()).map(|l| { - assert!(l - .iter() - .any(|message| message.contains("NextBranchResetRequired"))) - })?; + log.require_message_containing("NextBranchResetRequired")?; Ok(()) } @@ -145,12 +135,7 @@ async fn repo_with_next_not_based_on_main_should_be_reset() -> TestResult { System::current().stop(); //then - tracing::debug!(?log, ""); - log.read().map_err(|e| e.to_string()).map(|l| { - assert!(l - .iter() - .any(|message| message.contains("NextBranchResetRequired"))) - })?; + log.require_message_containing("NextBranchResetRequired")?; Ok(()) } @@ -195,11 +180,7 @@ async fn repo_with_next_ahead_of_main_should_check_ci_status() -> TestResult { System::current().stop(); //then - tracing::debug!(?log, ""); - log.read().map_err(|e| e.to_string()).map(|l| { - let expected = format!("send: CheckCIStatus({next_commit:?})"); - assert!(l.iter().any(|message| message.contains(&expected))) - })?; + log.require_message_containing(format!("send: CheckCIStatus({next_commit:?})"))?; Ok(()) } @@ -245,10 +226,7 @@ async fn repo_with_dev_and_next_on_main_should_do_nothing() -> TestResult { System::current().stop(); //then - tracing::debug!(?log, ""); - log.read() - .map_err(|e| e.to_string()) - .map(|l| assert!(!l.iter().any(|message| message.contains("send:"))))?; + log.no_message_contains("send:")?; Ok(()) } @@ -295,11 +273,9 @@ async fn repo_with_dev_ahead_of_next_should_advance_next() -> TestResult { System::current().stop(); //then - tracing::debug!(?log, ""); - log.read().map_err(|e| e.to_string()).map(|l| { - let expected = format!("send: AdvanceNext(({next_commit:?}, {dev_branch_log:?}))"); - assert!(l.iter().any(|message| message.contains(&expected))) - })?; + log.require_message_containing(format!( + "send: AdvanceNext(({next_commit:?}, {dev_branch_log:?}))" + ))?; Ok(()) } @@ -325,12 +301,7 @@ async fn should_accept_message_with_current_token() -> TestResult { System::current().stop(); //then - tracing::debug!(?log, ""); - log.read().map_err(|e| e.to_string()).map(|l| { - assert!(l - .iter() - .any(|message| message.contains("accepted token: 2"))) - })?; + log.require_message_containing("accepted token: 2")?; Ok(()) } @@ -354,12 +325,7 @@ async fn should_accept_message_with_new_token() -> TestResult { System::current().stop(); //then - tracing::debug!(?log, ""); - log.read().map_err(|e| e.to_string()).map(|l| { - assert!(l - .iter() - .any(|message| message.contains("accepted token: 3"))) - })?; + log.require_message_containing("accepted token: 3")?; Ok(()) } @@ -383,9 +349,6 @@ async fn should_reject_message_with_expired_token() -> TestResult { System::current().stop(); //then - tracing::debug!(?log, ""); - log.read() - .map_err(|e| e.to_string()) - .map(|l| assert!(!l.iter().any(|message| message.contains("accepted token"))))?; + log.no_message_contains("accepted token")?; Ok(()) }