Skip to content
Open
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
13 changes: 10 additions & 3 deletions conformance/utils/suite/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,13 +533,20 @@ func (suite *ConformanceTestSuite) Run(t *testing.T, tests []ConformanceTest) er
t.Run(test.ShortName, func(subT *testing.T) {
subT.Cleanup(func() {
suite.recordTestResult(subT, test, res)
if suite.Hook != nil {
suite.Hook(subT, test, suite)
}
})
err := suite.setClientsetForTest(test)
require.NoError(subT, err, "failed to create new clientset for test")
test.Run(subT, suite)
// Register the Hook's cleanup only after test.Run has returned, so it is
// the last cleanup registered on subT. testing.T runs Cleanup funcs in
// LIFO order, so this makes the Hook run before any cleanup the test
// itself registered during test.Run (e.g. deleting the resources it
// created), while resources are still present for the Hook to inspect.
if suite.Hook != nil {
subT.Cleanup(func() {
suite.Hook(subT, test, suite)
})
}
})

if res == testSucceeded {
Expand Down