e2e: skip AllNodesReady when the test skipped framework initialization

This addresses a problem caused by
https://github.com/kubernetes/kubernetes/pull/112043: because the AfterEach
which invokes AllNodesReady always runs, including tests that skipped early,
those tests ran into a nil pointer access. This increased the size of log
files. The tests still worked.
This commit is contained in:
Patrick Ohly
2022-10-17 10:27:14 +02:00
parent 48608cfe60
commit 3c162af45f
2 changed files with 19 additions and 2 deletions

View File

@@ -30,6 +30,12 @@ func init() {
framework.NewFrameworkExtensions = append(framework.NewFrameworkExtensions,
func(f *framework.Framework) {
ginkgo.AfterEach(func() {
if f.ClientSet == nil {
// Test didn't reach f.BeforeEach, most
// likely because the test got
// skipped. Nothing to check...
return
}
e2enode.AllNodesReady(f.ClientSet, 3*time.Minute)
})
},