@@ -18,7 +18,6 @@ package autoscaling
1818
1919import (
2020 "fmt"
21- "time"
2221
2322 autoscaling "k8s.io/api/autoscaling/v1"
2423 apiv1 "k8s.io/api/core/v1"
@@ -44,7 +43,6 @@ const (
4443)
4544
4645var _ = FullVpaE2eDescribe ("Pods under VPA" , func () {
47- return
4846 var (
4947 rc * ResourceConsumer
5048 vpaClientSet * vpa_clientset.Clientset
@@ -93,30 +91,30 @@ var _ = FullVpaE2eDescribe("Pods under VPA", func() {
9391 ginkgo .It ("have cpu requests growing with usage" , func () {
9492 // initial CPU usage is low so a minimal recommendation is expected
9593 err := waitForResourceRequestInRangeInPods (
96- f , pollTimeout , metav1.ListOptions {LabelSelector : "name=hamster" }, apiv1 .ResourceCPU ,
94+ f , metav1.ListOptions {LabelSelector : "name=hamster" }, apiv1 .ResourceCPU ,
9795 ParseQuantityOrDie (minimalCPULowerBound ), ParseQuantityOrDie (minimalCPUUpperBound ))
9896 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
9997
10098 // consume more CPU to get a higher recommendation
10199 rc .ConsumeCPU (600 * replicas )
102100 err = waitForResourceRequestInRangeInPods (
103- f , pollTimeout , metav1.ListOptions {LabelSelector : "name=hamster" }, apiv1 .ResourceCPU ,
101+ f , metav1.ListOptions {LabelSelector : "name=hamster" }, apiv1 .ResourceCPU ,
104102 ParseQuantityOrDie ("500m" ), ParseQuantityOrDie ("900m" ))
105103 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
106104 })
107105
108106 ginkgo .It ("have memory requests growing with usage" , func () {
109107 // initial memory usage is low so a minimal recommendation is expected
110108 err := waitForResourceRequestInRangeInPods (
111- f , pollTimeout , metav1.ListOptions {LabelSelector : "name=hamster" }, apiv1 .ResourceMemory ,
109+ f , metav1.ListOptions {LabelSelector : "name=hamster" }, apiv1 .ResourceMemory ,
112110 ParseQuantityOrDie (minimalMemoryLowerBound ), ParseQuantityOrDie (minimalMemoryUpperBound ))
113111 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
114112
115113 // consume more memory to get a higher recommendation
116114 // NOTE: large range given due to unpredictability of actual memory usage
117115 rc .ConsumeMem (1024 * replicas )
118116 err = waitForResourceRequestInRangeInPods (
119- f , pollTimeout , metav1.ListOptions {LabelSelector : "name=hamster" }, apiv1 .ResourceMemory ,
117+ f , metav1.ListOptions {LabelSelector : "name=hamster" }, apiv1 .ResourceMemory ,
120118 ParseQuantityOrDie ("900Mi" ), ParseQuantityOrDie ("4000Mi" ))
121119 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
122120 })
@@ -159,14 +157,14 @@ var _ = FullVpaE2eDescribe("OOMing pods under VPA", func() {
159157 ginkgo .It ("have memory requests growing with OOMs" , func () {
160158 listOptions := metav1.ListOptions {LabelSelector : "name=hamster" , FieldSelector : getPodSelectorExcludingDonePodsOrDie ()}
161159 err := waitForResourceRequestInRangeInPods (
162- f , 7 * time . Minute , listOptions , apiv1 .ResourceMemory ,
160+ f , listOptions , apiv1 .ResourceMemory ,
163161 ParseQuantityOrDie ("1400Mi" ), ParseQuantityOrDie ("10000Mi" ))
164162 gomega .Expect (err ).NotTo (gomega .HaveOccurred ())
165163 })
166164})
167165
168- func waitForPodsMatch (f * framework.Framework , timeout time. Duration , listOptions metav1.ListOptions , matcher func (pod apiv1.Pod ) bool ) error {
169- return wait .PollImmediate (pollInterval , timeout , func () (bool , error ) {
166+ func waitForPodsMatch (f * framework.Framework , listOptions metav1.ListOptions , matcher func (pod apiv1.Pod ) bool ) error {
167+ return wait .PollImmediate (pollInterval , pollTimeout , func () (bool , error ) {
170168
171169 ns := f .Namespace .Name
172170 c := f .ClientSet
@@ -195,8 +193,8 @@ func waitForPodsMatch(f *framework.Framework, timeout time.Duration, listOptions
195193 })
196194}
197195
198- func waitForResourceRequestInRangeInPods (f * framework.Framework , timeout time. Duration , listOptions metav1.ListOptions , resourceName apiv1.ResourceName , lowerBound , upperBound resource.Quantity ) error {
199- err := waitForPodsMatch (f , timeout , listOptions ,
196+ func waitForResourceRequestInRangeInPods (f * framework.Framework , listOptions metav1.ListOptions , resourceName apiv1.ResourceName , lowerBound , upperBound resource.Quantity ) error {
197+ err := waitForPodsMatch (f , listOptions ,
200198 func (pod apiv1.Pod ) bool {
201199 resourceRequest , found := pod .Spec .Containers [0 ].Resources .Requests [resourceName ]
202200 framework .Logf ("Comparing %v request %v against range of (%v, %v)" , resourceName , resourceRequest , lowerBound , upperBound )
0 commit comments