fix: operating region guards should be dropped when procedure is done (#3775)

This commit is contained in:
LFC
2024-04-23 14:21:53 +08:00
committed by GitHub
parent 96c01a3bf0
commit 19a9035f4b
4 changed files with 73 additions and 16 deletions

View File

@@ -121,3 +121,22 @@ pub fn new_test_procedure_context() -> Context {
provider: Arc::new(MockContextProvider::default()),
}
}
pub async fn execute_procedure_until<P: Procedure>(procedure: &mut P, until: impl Fn(&P) -> bool) {
let mut reached = false;
let context = new_test_procedure_context();
while !matches!(
procedure.execute(&context).await.unwrap(),
Status::Done { .. }
) {
if until(procedure) {
reached = true;
break;
}
}
assert!(
reached,
"procedure '{}' did not reach the expected state",
procedure.type_name()
);
}