Skip to content

Commit

Permalink
e2e-tests: Add a default deletion time for all tests
Browse files Browse the repository at this point in the history
This ensures that all the pods are deleted before we move on to clean up
CAA and other resources.

Fixes: #1480

Signed-off-by: Suraj Deshmukh <[email protected]>
  • Loading branch information
surajssd authored and kartikjoshi21 committed Oct 5, 2023
1 parent a4d57fd commit cf07e8a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions test/e2e/common_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,15 +345,20 @@ func (tc *testCase) run() {
}
log.Infof("Deleting pod %s...", tc.pod.Name)

if tc.deletionWithin != nil {
if err = wait.For(conditions.New(
client.Resources()).ResourceDeleted(tc.pod),
wait.WithInterval(5*time.Second),
wait.WithTimeout(*tc.deletionWithin)); err != nil {
t.Fatal(err)
}
log.Infof("Pod %s has been successfully deleted within %.0fs", tc.pod.Name, tc.deletionWithin.Seconds())
// Add a default deleteWithin time.
if tc.deletionWithin == nil {
deleteWithin := time.Second * 300
tc.deletionWithin = &deleteWithin
}

if err = wait.For(conditions.New(
client.Resources()).ResourceDeleted(tc.pod),
wait.WithInterval(5*time.Second),
wait.WithTimeout(*tc.deletionWithin)); err != nil {
t.Fatal(err)
}

log.Infof("Pod %s has been successfully deleted", tc.pod.Name)
}

if tc.pvc != nil {
Expand Down

0 comments on commit cf07e8a

Please sign in to comment.