Commit 7d852feb authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #26794 from yujuhong/wait_before_test

Automatic merge from submit-queue kubelet e2e: enforce that image prepulling must finish before the test The image prepulling pod calls docker directly to pull images. If the pod hasn't finished before running the resource usage tracking test, there'd be a cpu spike in docker. We'd rather wait and fail if this is the case, before running the test.
parents 3f1960b7 02d7af28
...@@ -21,6 +21,7 @@ import ( ...@@ -21,6 +21,7 @@ import (
"strings" "strings"
"time" "time"
"k8s.io/kubernetes/pkg/api"
client "k8s.io/kubernetes/pkg/client/unversioned" client "k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/stats" "k8s.io/kubernetes/pkg/kubelet/api/v1alpha1/stats"
"k8s.io/kubernetes/pkg/util" "k8s.io/kubernetes/pkg/util"
...@@ -38,6 +39,8 @@ const ( ...@@ -38,6 +39,8 @@ const (
monitoringTime = 20 * time.Minute monitoringTime = 20 * time.Minute
// The periodic reporting period. // The periodic reporting period.
reportingPeriod = 5 * time.Minute reportingPeriod = 5 * time.Minute
// Timeout for waiting for the image prepulling to complete.
imagePrePullingLongTimeout = time.Minute * 8
) )
type resourceTest struct { type resourceTest struct {
...@@ -193,6 +196,12 @@ var _ = framework.KubeDescribe("Kubelet [Serial] [Slow]", func() { ...@@ -193,6 +196,12 @@ var _ = framework.KubeDescribe("Kubelet [Serial] [Slow]", func() {
var rm *framework.ResourceMonitor var rm *framework.ResourceMonitor
BeforeEach(func() { BeforeEach(func() {
// Wait until image prepull pod has completed so that they wouldn't
// affect the runtime cpu usage. Fail the test if prepulling cannot
// finish in time.
if err := framework.WaitForPodsSuccess(f.Client, api.NamespaceSystem, framework.ImagePullerLabels, imagePrePullingLongTimeout); err != nil {
framework.Failf("Image puller didn't complete in %v, not running resource usage test since the metrics might be adultrated", imagePrePullingLongTimeout)
}
nodes := framework.GetReadySchedulableNodesOrDie(f.Client) nodes := framework.GetReadySchedulableNodesOrDie(f.Client)
nodeNames = sets.NewString() nodeNames = sets.NewString()
for _, node := range nodes.Items { for _, node := range nodes.Items {
......
...@@ -424,9 +424,10 @@ var _ = framework.KubeDescribe("Nodes [Disruptive]", func() { ...@@ -424,9 +424,10 @@ var _ = framework.KubeDescribe("Nodes [Disruptive]", func() {
// Many e2e tests assume that the cluster is fully healthy before they start. Wait until // Many e2e tests assume that the cluster is fully healthy before they start. Wait until
// the cluster is restored to health. // the cluster is restored to health.
By("waiting for system pods to successfully restart") By("waiting for system pods to successfully restart")
err := framework.WaitForPodsRunningReady(c, api.NamespaceSystem, systemPodsNo, framework.PodReadyBeforeTimeout, ignoreLabels) err := framework.WaitForPodsRunningReady(c, api.NamespaceSystem, systemPodsNo, framework.PodReadyBeforeTimeout, ignoreLabels)
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
By("waiting for image prepulling pods to complete")
framework.WaitForPodsSuccess(c, api.NamespaceSystem, framework.ImagePullerLabels, imagePrePullingTimeout)
}) })
It("should be able to delete nodes", func() { It("should be able to delete nodes", func() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment