Merge pull request #114825 from pohly/e2e-pod-consistently-pending

e2: fix check of "pod is consistently pending"
This commit is contained in:
Kubernetes Prow Robot
2023-01-22 12:56:02 -08:00
committed by GitHub
13 changed files with 596 additions and 51 deletions

View File

@@ -22,6 +22,8 @@ import (
"time"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
v1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
@@ -128,8 +130,9 @@ var _ = utils.SIGDescribe("CSI Mock volume attach", func() {
err = e2eevents.WaitTimeoutForEvent(ctx, m.cs, pod.Namespace, eventSelector, msg, f.Timeouts.PodStart)
if err != nil {
podErr := e2epod.WaitTimeoutForPodRunningInNamespace(ctx, m.cs, pod.Name, pod.Namespace, 10*time.Second)
framework.ExpectError(podErr, "Pod should not be in running status because attaching should failed")
getPod := e2epod.Get(m.cs, pod)
gomega.Consistently(ctx, getPod).WithTimeout(10*time.Second).Should(e2epod.BeInPhase(v1.PodPending),
"Pod should not be in running status because attaching should failed")
// Events are unreliable, don't depend on the event. It's used only to speed up the test.
framework.Logf("Attach should fail and the corresponding event should show up, error: %v", err)
}