Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions test/cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,17 @@ func TearDown(clients *Clients, names *ResourceNames) {
// EnsureCleanup will run the provided cleanup function when the test ends,
// either via t.Cleanup or on interrupt via CleanupOnInterrupt.
func EnsureCleanup(t *testing.T, cleanup func()) {
if t.Failed() && ServingFlags.SkipCleanupOnFail {
t.Log("skipping cleanup")
return
f := func() {
if t.Failed() && ServingFlags.SkipCleanupOnFail {
t.Log("skipping cleanup")
return
}

cleanup()
}
t.Cleanup(cleanup)
CleanupOnInterrupt(cleanup)

t.Cleanup(f)
CleanupOnInterrupt(f)
}

// EnsureTearDown will delete created names when the test ends, either via
Expand Down
Loading