mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-06 02:34:03 +00:00
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:
parent
eafebcc9e3
commit
7d077f9271
@ -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))
|
||||
})
|
||||
})
|
||||
},
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user