e2e: move AllNodesReady check to DeferCleanup
Some test cases can make nodes not ready and use DeferCleanup to bring nodes back online. Checking if all nodes are online would fail in such cases as AfterEach runs before DeferCleanup. Scheduling nodes readines check to DeferCleanup should solve this issue as nodes would be brought back to a `Ready` state before the check.
This commit is contained in:
@@ -30,14 +30,10 @@ import (
|
||||
func init() {
|
||||
framework.NewFrameworkExtensions = append(framework.NewFrameworkExtensions,
|
||||
func(f *framework.Framework) {
|
||||
ginkgo.AfterEach(func(ctx context.Context) {
|
||||
if f.ClientSet == nil {
|
||||
// Test didn't reach f.BeforeEach, most
|
||||
// likely because the test got
|
||||
// skipped. Nothing to check...
|
||||
return
|
||||
}
|
||||
e2enode.AllNodesReady(ctx, f.ClientSet, 7*time.Minute)
|
||||
ginkgo.BeforeEach(func() {
|
||||
ginkgo.DeferCleanup(func(ctx context.Context) {
|
||||
framework.ExpectNoError(e2enode.AllNodesReady(ctx, f.ClientSet, 7*time.Minute))
|
||||
})
|
||||
})
|
||||
},
|
||||
)
|
||||
|
Reference in New Issue
Block a user