Commit 5177e82d authored by Yu-Ju Hong's avatar Yu-Ju Hong

e2e: restore the test for monotonically increasing restart count

The test was disabled because sometimes restart count could not reach the target before timeout. This change lowers the target restart count, increases the timeout threshold to 5 minutes, and adds the test to the SLOW suite. Running the test in a local cluster takes ~1m40s to complete.
parent ca3ae476
......@@ -119,7 +119,6 @@ GCE_FLAKY_TESTS=(
"DaemonRestart"
"Daemon\sset\sshould\slaunch\sa\sdaemon\spod\son\severy\snode\sof\sthe\scluster"
"Resource\susage\sof\ssystem\scontainers"
"monotonically\sincreasing\srestart\scount"
"should\sbe\sable\sto\schange\sthe\stype\sand\snodeport\ssettings\sof\sa\sservice" # file: service.go, issue: #13032
"allows\sscheduling\sof\spods\son\sa\sminion\safter\sit\srejoins\sthe\scluster" # file: resize_nodes.go, issue: #13258
"should\srelease\sthe\sload\sbalancer\swhen\sType\sgoes\sfrom\sLoadBalancer" # timeouts in 20 minutes in last builds. #14424
......@@ -137,6 +136,7 @@ GCE_SLOW_TESTS=(
"SchedulerPredicates\svalidates\sMaxPods\slimit " # 8 min, file: scheduler_predicates.go, PR: #13315
"Nodes\sResize" # 3 min 30 sec, file: resize_nodes.go, issue: #13323
"resource\susage\stracking" # 1 hour, file: kubelet_perf.go, slow by design
"monotonically\sincreasing\srestart\scount" # 1.5 to 5 min, file: pods.go, slow by design
)
# Tests which are not able to be run in parallel.
......
......@@ -35,7 +35,11 @@ import (
. "github.com/onsi/gomega"
)
func runLivenessTest(c *client.Client, ns string, podDescr *api.Pod, expectNumRestarts int) {
const (
defaultObservationTimeout = time.Minute * 2
)
func runLivenessTest(c *client.Client, ns string, podDescr *api.Pod, expectNumRestarts int, timeout time.Duration) {
By(fmt.Sprintf("Creating pod %s in namespace %s", podDescr.Name, ns))
_, err := c.Pods(ns).Create(podDescr)
expectNoError(err, fmt.Sprintf("creating pod %s", podDescr.Name))
......@@ -61,7 +65,7 @@ func runLivenessTest(c *client.Client, ns string, podDescr *api.Pod, expectNumRe
By(fmt.Sprintf("Initial restart count of pod %s is %d", podDescr.Name, initialRestartCount))
// Wait for the restart state to be as desired.
deadline := time.Now().Add(2 * time.Minute)
deadline := time.Now().Add(timeout)
lastRestartCount := initialRestartCount
observedRestarts := 0
for start := time.Now(); time.Now().Before(deadline); time.Sleep(2 * time.Second) {
......@@ -482,7 +486,7 @@ var _ = Describe("Pods", func() {
},
},
},
}, 1)
}, 1, defaultObservationTimeout)
})
It("should *not* be restarted with a docker exec \"cat /tmp/health\" liveness probe", func() {
......@@ -508,7 +512,7 @@ var _ = Describe("Pods", func() {
},
},
},
}, 0)
}, 0, defaultObservationTimeout)
})
It("should be restarted with a /healthz http liveness probe", func() {
......@@ -535,10 +539,10 @@ var _ = Describe("Pods", func() {
},
},
},
}, 1)
}, 1, defaultObservationTimeout)
})
PIt("should have monotonically increasing restart count", func() {
It("should have monotonically increasing restart count", func() {
runLivenessTest(framework.Client, framework.Namespace.Name, &api.Pod{
ObjectMeta: api.ObjectMeta{
Name: "liveness-http",
......@@ -562,7 +566,7 @@ var _ = Describe("Pods", func() {
},
},
},
}, 8)
}, 5, time.Minute*5)
})
It("should *not* be restarted with a /healthz http liveness probe", func() {
......@@ -595,7 +599,7 @@ var _ = Describe("Pods", func() {
},
},
},
}, 0)
}, 0, defaultObservationTimeout)
})
// The following tests for remote command execution and port forwarding are
......
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