@@ -122,13 +122,16 @@ func doPodResizeTests(f *framework.Framework) {
122
122
patchString string
123
123
expected []e2epod.ResizableContainerInfo
124
124
addExtendedResource bool
125
+ // TODO(123940): test rollback for all test cases once resize is more responsive.
126
+ testRollback bool
125
127
}
126
128
127
129
noRestart := v1 .NotRequired
128
130
doRestart := v1 .RestartContainer
129
131
tests := []testCase {
130
132
{
131
- name : "Guaranteed QoS pod, one container - increase CPU & memory" ,
133
+ name : "Guaranteed QoS pod, one container - increase CPU & memory" ,
134
+ testRollback : true ,
132
135
containers : []e2epod.ResizableContainerInfo {
133
136
{
134
137
Name : "c1" ,
@@ -208,7 +211,8 @@ func doPodResizeTests(f *framework.Framework) {
208
211
},
209
212
},
210
213
{
211
- name : "Guaranteed QoS pod, three containers (c1, c2, c3) - increase: CPU (c1,c3), memory (c2) ; decrease: CPU (c2), memory (c1,c3)" ,
214
+ name : "Guaranteed QoS pod, three containers (c1, c2, c3) - increase: CPU (c1,c3), memory (c2) ; decrease: CPU (c2), memory (c1,c3)" ,
215
+ testRollback : true ,
212
216
containers : []e2epod.ResizableContainerInfo {
213
217
{
214
218
Name : "c1" ,
@@ -256,7 +260,8 @@ func doPodResizeTests(f *framework.Framework) {
256
260
},
257
261
},
258
262
{
259
- name : "Burstable QoS pod, one container with cpu & memory requests + limits - decrease memory requests only" ,
263
+ name : "Burstable QoS pod, one container with cpu & memory requests + limits - decrease memory requests only" ,
264
+ testRollback : true ,
260
265
containers : []e2epod.ResizableContainerInfo {
261
266
{
262
267
Name : "c1" ,
@@ -274,7 +279,8 @@ func doPodResizeTests(f *framework.Framework) {
274
279
},
275
280
},
276
281
{
277
- name : "Burstable QoS pod, one container with cpu & memory requests + limits - decrease memory limits only" ,
282
+ name : "Burstable QoS pod, one container with cpu & memory requests + limits - decrease memory limits only" ,
283
+ testRollback : true ,
278
284
containers : []e2epod.ResizableContainerInfo {
279
285
{
280
286
Name : "c1" ,
@@ -328,7 +334,8 @@ func doPodResizeTests(f *framework.Framework) {
328
334
},
329
335
},
330
336
{
331
- name : "Burstable QoS pod, one container with cpu & memory requests + limits - decrease CPU requests only" ,
337
+ name : "Burstable QoS pod, one container with cpu & memory requests + limits - decrease CPU requests only" ,
338
+ testRollback : true ,
332
339
containers : []e2epod.ResizableContainerInfo {
333
340
{
334
341
Name : "c1" ,
@@ -346,7 +353,8 @@ func doPodResizeTests(f *framework.Framework) {
346
353
},
347
354
},
348
355
{
349
- name : "Burstable QoS pod, one container with cpu & memory requests + limits - decrease CPU limits only" ,
356
+ name : "Burstable QoS pod, one container with cpu & memory requests + limits - decrease CPU limits only" ,
357
+ testRollback : true ,
350
358
containers : []e2epod.ResizableContainerInfo {
351
359
{
352
360
Name : "c1" ,
@@ -634,7 +642,8 @@ func doPodResizeTests(f *framework.Framework) {
634
642
},
635
643
},
636
644
{
637
- name : "Guaranteed QoS pod, one container - increase CPU (NotRequired) & memory (RestartContainer)" ,
645
+ name : "Guaranteed QoS pod, one container - increase CPU (NotRequired) & memory (RestartContainer)" ,
646
+ testRollback : true ,
638
647
containers : []e2epod.ResizableContainerInfo {
639
648
{
640
649
Name : "c1" ,
@@ -657,7 +666,8 @@ func doPodResizeTests(f *framework.Framework) {
657
666
},
658
667
},
659
668
{
660
- name : "Burstable QoS pod, one container - decrease CPU (RestartContainer) & memory (NotRequired)" ,
669
+ name : "Burstable QoS pod, one container - decrease CPU (RestartContainer) & memory (NotRequired)" ,
670
+ testRollback : true ,
661
671
containers : []e2epod.ResizableContainerInfo {
662
672
{
663
673
Name : "c1" ,
@@ -850,8 +860,6 @@ func doPodResizeTests(f *framework.Framework) {
850
860
},
851
861
}
852
862
853
- timeouts := f .Timeouts
854
-
855
863
for idx := range tests {
856
864
tc := tests [idx ]
857
865
ginkgo .It (tc .name , func (ctx context.Context ) {
@@ -862,7 +870,8 @@ func doPodResizeTests(f *framework.Framework) {
862
870
tStamp := strconv .Itoa (time .Now ().Nanosecond ())
863
871
e2epod .InitDefaultResizePolicy (tc .containers )
864
872
e2epod .InitDefaultResizePolicy (tc .expected )
865
- testPod = e2epod .MakePodWithResizableContainers (f .Namespace .Name , "testpod" , tStamp , tc .containers )
873
+ testPod = e2epod .MakePodWithResizableContainers (f .Namespace .Name , "" , tStamp , tc .containers )
874
+ testPod .GenerateName = "resize-test-"
866
875
testPod = e2epod .MustMixinRestrictedPodSecurity (testPod )
867
876
868
877
if tc .addExtendedResource {
@@ -908,22 +917,24 @@ func doPodResizeTests(f *framework.Framework) {
908
917
909
918
patchAndVerify (tc .patchString , tc .expected , "resize" )
910
919
911
- // Resize has been actuated, test rollback
912
- rollbackContainers := make ([]e2epod.ResizableContainerInfo , len (tc .containers ))
913
- copy (rollbackContainers , tc .containers )
914
- for i , c := range rollbackContainers {
915
- gomega .Expect (c .Name ).To (gomega .Equal (tc .expected [i ].Name ),
916
- "test case containers & expectations should be in the same order" )
917
- // Resizes that trigger a restart should trigger a second restart when rolling back.
918
- rollbackContainers [i ].RestartCount = tc .expected [i ].RestartCount * 2
919
- }
920
+ if tc .testRollback {
921
+ // Resize has been actuated, test rollback
922
+ rollbackContainers := make ([]e2epod.ResizableContainerInfo , len (tc .containers ))
923
+ copy (rollbackContainers , tc .containers )
924
+ for i , c := range rollbackContainers {
925
+ gomega .Expect (c .Name ).To (gomega .Equal (tc .expected [i ].Name ),
926
+ "test case containers & expectations should be in the same order" )
927
+ // Resizes that trigger a restart should trigger a second restart when rolling back.
928
+ rollbackContainers [i ].RestartCount = tc .expected [i ].RestartCount * 2
929
+ }
920
930
921
- rbPatchStr , err := e2epod .ResizeContainerPatch (tc .containers )
922
- framework .ExpectNoError (err )
923
- patchAndVerify (rbPatchStr , rollbackContainers , "rollback" )
931
+ rbPatchStr , err := e2epod .ResizeContainerPatch (tc .containers )
932
+ framework .ExpectNoError (err )
933
+ patchAndVerify (rbPatchStr , rollbackContainers , "rollback" )
934
+ }
924
935
925
936
ginkgo .By ("deleting pod" )
926
- podClient .DeleteSync (ctx , newPod .Name , metav1.DeleteOptions {}, timeouts . PodDelete )
937
+ framework . ExpectNoError ( podClient .Delete (ctx , newPod .Name , metav1.DeleteOptions {}) )
927
938
})
928
939
}
929
940
}
0 commit comments