Fix:[Flake] [sig-node] Restart [Serial] [Slow] [Disruptive] Kubelet should correctly account for terminated pods after restart

This commit is contained in:
ZhangKe10140699 2022-03-23 16:54:22 +08:00
parent 492637878f
commit 572360c5a5

View File

@ -28,6 +28,9 @@ import (
"strings"
"time"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
testutils "k8s.io/kubernetes/test/utils"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -35,7 +38,6 @@ import (
"k8s.io/apimachinery/pkg/util/uuid"
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1"
"k8s.io/kubernetes/test/e2e/framework"
e2epod "k8s.io/kubernetes/test/e2e/framework/pod"
imageutils "k8s.io/kubernetes/test/utils/image"
admissionapi "k8s.io/pod-security-admission/api"
@ -196,6 +198,9 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
},
},
})
if err := e2epod.WaitForPodCondition(ctx, f.ClientSet, f.Namespace.Name, podName, "Ready", 120*time.Second, testutils.PodRunningReady); err != nil {
framework.ExpectNoError(err, fmt.Sprintf("Pod %v could not enter running/ready", podName))
}
var (
ngPids []int
err error
@ -212,7 +217,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
}
return nil
}, 2*time.Minute, time.Second*4).Should(gomega.BeNil())
}, 30*time.Second, time.Second*4).Should(gomega.BeNil())
})
ginkgo.It("burstable container's oom-score-adj should be between [2, 1000)", func(ctx context.Context) {
@ -238,6 +243,9 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
},
},
})
if err := e2epod.WaitForPodCondition(ctx, f.ClientSet, f.Namespace.Name, podName, "Ready", 120*time.Second, testutils.PodRunningReady); err != nil {
framework.ExpectNoError(err, fmt.Sprintf("Pod %v could not enter running/ready", podName))
}
var (
wsPids []int
err error
@ -253,7 +261,7 @@ var _ = SIGDescribe("Container Manager Misc [Serial]", func() {
}
}
return nil
}, 2*time.Minute, time.Second*4).Should(gomega.BeNil())
}, 30*time.Second, time.Second*4).Should(gomega.BeNil())
// TODO: Test the oom-score-adj logic for burstable more accurately.
})