@@ -141,12 +141,6 @@ func TestTooManyRestarts(t *testing.T) {
141
141
policy : tooManyRestartsPolicy (testNamespace .Name , 3 , true , 0 ),
142
142
expectedEvictedPodCount : 4 ,
143
143
},
144
- {
145
- name : "test-one-evictions-use-gracePeriodSeconds" ,
146
- policy : tooManyRestartsPolicy (testNamespace .Name , 3 , true , 60 ),
147
- enableGracePeriod : true ,
148
- expectedEvictedPodCount : 4 ,
149
- },
150
144
}
151
145
for _ , tc := range tests {
152
146
t .Run (tc .name , func (t * testing.T ) {
@@ -204,31 +198,6 @@ func TestTooManyRestarts(t *testing.T) {
204
198
if len (deschedulerPods ) != 0 {
205
199
deschedulerPodName = deschedulerPods [0 ].Name
206
200
}
207
-
208
- // Check if grace period is enabled and wait accordingly
209
- if tc .enableGracePeriod {
210
- // Ensure no pods are evicted during the grace period
211
- // Wait for 55 seconds to ensure that the pods are not evicted during the grace period
212
- // We do not want to use an extreme waiting time, such as 59 seconds,
213
- // because the grace period is set to 60 seconds.
214
- // In order to avoid unnecessary flake failures,
215
- // we only need to make sure that the pod is not evicted within a certain range.
216
- t .Logf ("Waiting for grace period of %d seconds" , 55 )
217
- if err := wait .PollUntilContextTimeout (ctx , 1 * time .Second , time .Duration (55 )* time .Second , true , func (ctx context.Context ) (bool , error ) {
218
- currentRunNames := sets .NewString (getCurrentPodNames (ctx , clientSet , testNamespace .Name , t )... )
219
- actualEvictedPod := preRunNames .Difference (currentRunNames )
220
- actualEvictedPodCount := uint (actualEvictedPod .Len ())
221
- t .Logf ("preRunNames: %v, currentRunNames: %v, actualEvictedPodCount: %v\n " , preRunNames .List (), currentRunNames .List (), actualEvictedPodCount )
222
- if actualEvictedPodCount > 0 {
223
- t .Fatalf ("Pods were evicted during grace period; expected 0, got %v" , actualEvictedPodCount )
224
- return false , nil
225
- }
226
- return true , nil
227
- }); err != nil {
228
- t .Fatalf ("Error waiting during grace period: %v" , err )
229
- }
230
- }
231
-
232
201
// Run RemovePodsHavingTooManyRestarts strategy
233
202
if err := wait .PollUntilContextTimeout (ctx , 1 * time .Second , 50 * time .Second , true , func (ctx context.Context ) (bool , error ) {
234
203
currentRunNames := sets .NewString (getCurrentPodNames (ctx , clientSet , testNamespace .Name , t )... )
0 commit comments