Skip to content

Commit

Permalink
Change cleanup to delete without grace (#2230)
Browse files Browse the repository at this point in the history
  • Loading branch information
aviramha authored Feb 13, 2024
1 parent 07e4724 commit 0486c40
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog.d/+delete-forcefully-on-tests.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Change cleanup to delete without grace
20 changes: 13 additions & 7 deletions tests/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,11 @@ impl ResourceGuard {

let deleter = async move {
println!("Deleting resource `{name}`");
let res = api.delete(&name, &DeleteParams::default()).await;
let delete_params = DeleteParams {
grace_period_seconds: Some(0),
..Default::default()
};
let res = api.delete(&name, &delete_params).await;
if let Err(e) = res {
println!("Failed to delete resource `{name}`: {e:?}");
}
Expand Down Expand Up @@ -672,12 +676,14 @@ pub async fn service(
} else {
// If using a non-random name, delete existing resources first.
// Just continue if they don't exist.
let _ = service_api
.delete(service_name, &DeleteParams::default())
.await;
let _ = deployment_api
.delete(service_name, &DeleteParams::default())
.await;
// Force delete
let delete_params = DeleteParams {
grace_period_seconds: Some(0),
..Default::default()
};

let _ = service_api.delete(service_name, &delete_params).await;
let _ = deployment_api.delete(service_name, &delete_params).await;

service_name.to_string()
};
Expand Down

0 comments on commit 0486c40

Please sign in to comment.