@@ -167,10 +167,15 @@ func doPodResizeAdmissionPluginsTests() {
167
167
e2epod .VerifyPodResources (resizedPod , expected )
168
168
169
169
ginkgo .By ("patching pod for resize with memory exceeding resource quota" )
170
- _ , pErrExceedMemory := f .ClientSet .CoreV1 ().Pods (resizedPod .Namespace ).Patch (ctx ,
171
- resizedPod .Name , types .StrategicMergePatchType , []byte (patchStringExceedMemory ), metav1.PatchOptions {}, "resize" )
172
- gomega .Expect (pErrExceedMemory ).To (gomega .HaveOccurred ())
173
- gomega .Expect (pErrExceedMemory ).To (gomega .MatchError (gomega .ContainSubstring (tc .wantMemoryError )))
170
+ framework .ExpectNoError (framework .Gomega ().
171
+ // Use Eventually because we need to wait for the quota controller to sync.
172
+ Eventually (ctx , func (ctx context.Context ) error {
173
+ _ , pErrExceedMemory := f .ClientSet .CoreV1 ().Pods (resizedPod .Namespace ).Patch (ctx ,
174
+ resizedPod .Name , types .StrategicMergePatchType , []byte (patchStringExceedMemory ), metav1.PatchOptions {DryRun : []string {metav1 .DryRunAll }}, "resize" )
175
+ return pErrExceedMemory
176
+ }).
177
+ WithTimeout (f .Timeouts .PodStart ).
178
+ Should (gomega .MatchError (gomega .ContainSubstring (tc .wantMemoryError ))))
174
179
175
180
ginkgo .By ("verifying pod patched for resize exceeding memory resource quota remains unchanged" )
176
181
patchedPodExceedMemory , pErrEx2 := podClient .Get (ctx , resizedPod .Name , metav1.GetOptions {})
@@ -179,10 +184,15 @@ func doPodResizeAdmissionPluginsTests() {
179
184
framework .ExpectNoError (e2epod .VerifyPodStatusResources (patchedPodExceedMemory , expected ))
180
185
181
186
ginkgo .By (fmt .Sprintf ("patching pod %s for resize with CPU exceeding resource quota" , resizedPod .Name ))
182
- _ , pErrExceedCPU := f .ClientSet .CoreV1 ().Pods (resizedPod .Namespace ).Patch (ctx ,
183
- resizedPod .Name , types .StrategicMergePatchType , []byte (patchStringExceedCPU ), metav1.PatchOptions {}, "resize" )
184
- gomega .Expect (pErrExceedCPU ).To (gomega .HaveOccurred ())
185
- gomega .Expect (pErrExceedCPU ).To (gomega .MatchError (gomega .ContainSubstring (tc .wantCPUError )))
187
+ framework .ExpectNoError (framework .Gomega ().
188
+ // Use Eventually because we need to wait for the quota controller to sync.
189
+ Eventually (ctx , func (ctx context.Context ) error {
190
+ _ , pErrExceedCPU := f .ClientSet .CoreV1 ().Pods (resizedPod .Namespace ).Patch (ctx ,
191
+ resizedPod .Name , types .StrategicMergePatchType , []byte (patchStringExceedCPU ), metav1.PatchOptions {DryRun : []string {metav1 .DryRunAll }}, "resize" )
192
+ return pErrExceedCPU
193
+ }).
194
+ WithTimeout (f .Timeouts .PodStart ).
195
+ Should (gomega .MatchError (gomega .ContainSubstring (tc .wantCPUError ))))
186
196
187
197
ginkgo .By ("verifying pod patched for resize exceeding CPU resource quota remains unchanged" )
188
198
patchedPodExceedCPU , pErrEx1 := podClient .Get (ctx , resizedPod .Name , metav1.GetOptions {})
0 commit comments