Skip to content

Commit

Permalink
Run cleanup-all after all tests when running in prow.
Browse files Browse the repository at this point in the history
* We want to make sure the resources always get properly cleanup.
  For a given test, cleanup.sh is not run if there is failure in
  preceding script(setup.sh or cleanup.sh).
  • Loading branch information
sawsa307 committed Nov 15, 2023
1 parent 79b057e commit 53bdea6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ func TestMain(m *testing.M) {
}
project := ph.AcquireOrDie(flags.boskosResourceType)
defer func() {
out, err := exec.Command("bash", "test/cleanup-all.sh").CombinedOutput()
if err != nil {
// Fail now because we shouldn't continue testing if any step fails.
klog.Errorf("failed to run ./test/cleanup-all.sh: %q, err: %v", out, err)
}
ph.Release()
}()

Expand Down Expand Up @@ -79,7 +84,3 @@ func TestMain(m *testing.M) {

m.Run()
}

func TestHelloWorld(t *testing.T) {
klog.Info("Hello world")
}

0 comments on commit 53bdea6

Please sign in to comment.