Skip to content

Commit

Permalink
Proper handling of job removal on TestGateway subtests (#1462)
Browse files Browse the repository at this point in the history
Moved job deletion to a defer() call, to ensure it is executed in case of errors.
  • Loading branch information
hash-d authored May 2, 2024
1 parent 6fb3a1d commit 1acf74f
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions test/integration/acceptance/gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,14 @@ func testServices(t *testing.T) {
if err != nil {
return err
}
defer cluster.VanClient.KubeClient.BatchV1().Jobs(cluster.Namespace).Delete(context.TODO(), job.Name, v12.DeleteOptions{})

_, err = k8s.WaitForJob(cluster.Namespace, cluster.VanClient.KubeClient, name, time.Minute)
if err != nil {
_, _ = cluster.KubectlExec("logs job/" + name)
testRunner.DumpTestInfo(name)
return err
}
err = cluster.VanClient.KubeClient.BatchV1().Jobs(cluster.Namespace).Delete(context.TODO(), job.Name, v12.DeleteOptions{})
if err != nil {
return err
}
return nil
}

Expand Down

0 comments on commit 1acf74f

Please sign in to comment.