Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automated cherry pick of #85847: Deflake pod readiness e2e #85860

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 4 additions & 7 deletions test/e2e/common/pods.go
Expand Up @@ -27,7 +27,7 @@ import (

"golang.org/x/net/websocket"

"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -52,10 +52,6 @@ var (
buildBackOffDuration = time.Minute
syncLoopFrequency = 10 * time.Second
maxBackOffTolerance = time.Duration(1.3 * float64(kubelet.MaxContainerBackOff))
// maxReadyStatusUpdateTolerance specifies the latency that allows kubelet to update pod status.
// When kubelet is under heavy load (tests may be parallelized), the delay may be longer, hence
// causing tests to be flaky.
maxReadyStatusUpdateTolerance = 10 * time.Second
)

// testHostIP tests that a pod gets a host IP
Expand Down Expand Up @@ -816,7 +812,7 @@ var _ = framework.KubeDescribe("Pods", func() {
}

validatePodReadiness := func(expectReady bool) {
err := wait.Poll(time.Second, maxReadyStatusUpdateTolerance, func() (bool, error) {
err := wait.Poll(time.Second, wait.ForeverTestTimeout, func() (bool, error) {
podReady := podClient.PodIsReady(podName)
res := expectReady == podReady
if !res {
Expand All @@ -835,7 +831,8 @@ var _ = framework.KubeDescribe("Pods", func() {
_, err := podClient.Patch(podName, types.StrategicMergePatchType, []byte(fmt.Sprintf(patchStatusFmt, readinessGate1, "True")), "status")
framework.ExpectNoError(err)
// Sleep for 10 seconds.
time.Sleep(maxReadyStatusUpdateTolerance)
time.Sleep(syncLoopFrequency)
// Verify the pod is still not ready
gomega.Expect(podClient.PodIsReady(podName)).To(gomega.BeFalse(), "Expect pod's Ready condition to be false with only one condition in readinessGates equal to True")

ginkgo.By(fmt.Sprintf("patching pod status with condition %q to true", readinessGate2))
Expand Down