Merge pull request #121888 from SD-13/e2e-gomega-be-true-or-false

Enhance boolean assertions when fail
This commit is contained in:
Kubernetes Prow Robot
2024-08-20 04:24:42 -07:00
committed by GitHub
35 changed files with 135 additions and 161 deletions

View File

@@ -221,7 +221,7 @@ func updateKubeletConfig(ctx context.Context, f *framework.Framework, kubeletCon
// wait until the kubelet health check will fail
gomega.Eventually(ctx, func() bool {
return kubeletHealthCheck(kubeletHealthCheckURL)
}, time.Minute, time.Second).Should(gomega.BeFalse())
}, time.Minute, time.Second).Should(gomega.BeFalseBecause("expected kubelet health check to be failed"))
// Delete CPU and memory manager state files to be sure it will not prevent the kubelet restart
if deleteStateFiles {
@@ -240,14 +240,14 @@ func waitForKubeletToStart(ctx context.Context, f *framework.Framework) {
// wait until the kubelet health check will succeed
gomega.Eventually(ctx, func() bool {
return kubeletHealthCheck(kubeletHealthCheckURL)
}, 2*time.Minute, 5*time.Second).Should(gomega.BeTrue())
}, 2*time.Minute, 5*time.Second).Should(gomega.BeTrueBecause("expected kubelet to be in healthy state"))
// Wait for the Kubelet to be ready.
gomega.Eventually(ctx, func(ctx context.Context) bool {
nodes, err := e2enode.TotalReady(ctx, f.ClientSet)
framework.ExpectNoError(err)
return nodes == 1
}, time.Minute, time.Second).Should(gomega.BeTrue())
}, time.Minute, time.Second).Should(gomega.BeTrueBecause("expected kubelet to be in ready state"))
}
func deleteStateFile(stateFileName string) {