Skip to content

Commit a444c15

Browse files
committed
Deflake OOM tests
They pass but are a little flaky because they time out about on about 10% of the runs. The test seems to fail most ofteen with K8s 1.14 but also times out on other versions. Minor code clean ups (move out a const, break up a long line).
1 parent 9385626 commit a444c15

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

vertical-pod-autoscaler/e2e/v1/full_vpa.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ const (
3939
minimalMemoryLowerBound = "20Mi"
4040
minimalMemoryUpperBound = "300Mi"
4141
// the initial values should be outside minimal bounds
42-
initialCPU = int64(10) // mCPU
43-
initialMemory = int64(10) // MB
42+
initialCPU = int64(10) // mCPU
43+
initialMemory = int64(10) // MB
44+
oomTestTimeout = 8 * time.Minute
4445
)
4546

4647
var _ = FullVpaE2eDescribe("Pods under VPA", func() {
@@ -156,9 +157,12 @@ var _ = FullVpaE2eDescribe("OOMing pods under VPA", func() {
156157
})
157158

158159
ginkgo.It("have memory requests growing with OOMs", func() {
159-
listOptions := metav1.ListOptions{LabelSelector: "name=hamster", FieldSelector: getPodSelectorExcludingDonePodsOrDie()}
160+
listOptions := metav1.ListOptions{
161+
LabelSelector: "name=hamster",
162+
FieldSelector: getPodSelectorExcludingDonePodsOrDie(),
163+
}
160164
err := waitForResourceRequestInRangeInPods(
161-
f, 7*time.Minute, listOptions, apiv1.ResourceMemory,
165+
f, oomTestTimeout, listOptions, apiv1.ResourceMemory,
162166
ParseQuantityOrDie("1400Mi"), ParseQuantityOrDie("10000Mi"))
163167
gomega.Expect(err).NotTo(gomega.HaveOccurred())
164168
})

vertical-pod-autoscaler/e2e/v1beta2/full_vpa.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ const (
3939
minimalMemoryLowerBound = "20Mi"
4040
minimalMemoryUpperBound = "300Mi"
4141
// the initial values should be outside minimal bounds
42-
initialCPU = int64(10) // mCPU
43-
initialMemory = int64(10) // MB
42+
initialCPU = int64(10) // mCPU
43+
initialMemory = int64(10) // MB
44+
oomTestTimeout = 8 * time.Minute
4445
)
4546

4647
var _ = FullVpaE2eDescribe("Pods under VPA", func() {
@@ -156,9 +157,12 @@ var _ = FullVpaE2eDescribe("OOMing pods under VPA", func() {
156157
})
157158

158159
ginkgo.It("have memory requests growing with OOMs", func() {
159-
listOptions := metav1.ListOptions{LabelSelector: "name=hamster", FieldSelector: getPodSelectorExcludingDonePodsOrDie()}
160+
listOptions := metav1.ListOptions{
161+
LabelSelector: "name=hamster",
162+
FieldSelector: getPodSelectorExcludingDonePodsOrDie(),
163+
}
160164
err := waitForResourceRequestInRangeInPods(
161-
f, 7*time.Minute, listOptions, apiv1.ResourceMemory,
165+
f, oomTestTimeout, listOptions, apiv1.ResourceMemory,
162166
ParseQuantityOrDie("1400Mi"), ParseQuantityOrDie("10000Mi"))
163167
gomega.Expect(err).NotTo(gomega.HaveOccurred())
164168
})

0 commit comments

Comments
 (0)