forked from kemitix/git-next
refactor: tests: repo-actor: use methods on RepoActorLog
This commit is contained in:
parent
3e137c6480
commit
52df2114e5
1 changed files with 11 additions and 48 deletions
|
@ -43,12 +43,7 @@ async fn repo_with_next_not_an_ancestor_of_dev_should_be_reset() -> TestResult {
|
||||||
System::current().stop();
|
System::current().stop();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
tracing::debug!(?log, "");
|
log.require_message_containing("NextBranchResetRequired")?;
|
||||||
log.read().map_err(|e| e.to_string()).map(|l| {
|
|
||||||
assert!(l
|
|
||||||
.iter()
|
|
||||||
.any(|message| message.contains("NextBranchResetRequired")))
|
|
||||||
})?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,12 +89,7 @@ async fn repo_with_next_not_on_or_near_main_should_be_reset() -> TestResult {
|
||||||
System::current().stop();
|
System::current().stop();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
tracing::debug!(?log, "");
|
log.require_message_containing("NextBranchResetRequired")?;
|
||||||
log.read().map_err(|e| e.to_string()).map(|l| {
|
|
||||||
assert!(l
|
|
||||||
.iter()
|
|
||||||
.any(|message| message.contains("NextBranchResetRequired")))
|
|
||||||
})?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,12 +135,7 @@ async fn repo_with_next_not_based_on_main_should_be_reset() -> TestResult {
|
||||||
System::current().stop();
|
System::current().stop();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
tracing::debug!(?log, "");
|
log.require_message_containing("NextBranchResetRequired")?;
|
||||||
log.read().map_err(|e| e.to_string()).map(|l| {
|
|
||||||
assert!(l
|
|
||||||
.iter()
|
|
||||||
.any(|message| message.contains("NextBranchResetRequired")))
|
|
||||||
})?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,11 +180,7 @@ async fn repo_with_next_ahead_of_main_should_check_ci_status() -> TestResult {
|
||||||
System::current().stop();
|
System::current().stop();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
tracing::debug!(?log, "");
|
log.require_message_containing(format!("send: CheckCIStatus({next_commit:?})"))?;
|
||||||
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)))
|
|
||||||
})?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,10 +226,7 @@ async fn repo_with_dev_and_next_on_main_should_do_nothing() -> TestResult {
|
||||||
System::current().stop();
|
System::current().stop();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
tracing::debug!(?log, "");
|
log.no_message_contains("send:")?;
|
||||||
log.read()
|
|
||||||
.map_err(|e| e.to_string())
|
|
||||||
.map(|l| assert!(!l.iter().any(|message| message.contains("send:"))))?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,11 +273,9 @@ async fn repo_with_dev_ahead_of_next_should_advance_next() -> TestResult {
|
||||||
System::current().stop();
|
System::current().stop();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
tracing::debug!(?log, "");
|
log.require_message_containing(format!(
|
||||||
log.read().map_err(|e| e.to_string()).map(|l| {
|
"send: AdvanceNext(({next_commit:?}, {dev_branch_log:?}))"
|
||||||
let expected = format!("send: AdvanceNext(({next_commit:?}, {dev_branch_log:?}))");
|
))?;
|
||||||
assert!(l.iter().any(|message| message.contains(&expected)))
|
|
||||||
})?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,12 +301,7 @@ async fn should_accept_message_with_current_token() -> TestResult {
|
||||||
System::current().stop();
|
System::current().stop();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
tracing::debug!(?log, "");
|
log.require_message_containing("accepted token: 2")?;
|
||||||
log.read().map_err(|e| e.to_string()).map(|l| {
|
|
||||||
assert!(l
|
|
||||||
.iter()
|
|
||||||
.any(|message| message.contains("accepted token: 2")))
|
|
||||||
})?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,12 +325,7 @@ async fn should_accept_message_with_new_token() -> TestResult {
|
||||||
System::current().stop();
|
System::current().stop();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
tracing::debug!(?log, "");
|
log.require_message_containing("accepted token: 3")?;
|
||||||
log.read().map_err(|e| e.to_string()).map(|l| {
|
|
||||||
assert!(l
|
|
||||||
.iter()
|
|
||||||
.any(|message| message.contains("accepted token: 3")))
|
|
||||||
})?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,9 +349,6 @@ async fn should_reject_message_with_expired_token() -> TestResult {
|
||||||
System::current().stop();
|
System::current().stop();
|
||||||
|
|
||||||
//then
|
//then
|
||||||
tracing::debug!(?log, "");
|
log.no_message_contains("accepted token")?;
|
||||||
log.read()
|
|
||||||
.map_err(|e| e.to_string())
|
|
||||||
.map(|l| assert!(!l.iter().any(|message| message.contains("accepted token"))))?;
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue