Skip to content

Commit 52d5d63

Browse files
authored
Merge pull request #1606 from googs1025/revise/e2e_test_for_flake
flake: rollback gracePeriod for evict pod in e2e test
2 parents 0b3c022 + 6100c91 commit 52d5d63

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

test/e2e/e2e_toomanyrestarts_test.go

-31
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,6 @@ func TestTooManyRestarts(t *testing.T) {
141141
policy: tooManyRestartsPolicy(testNamespace.Name, 3, true, 0),
142142
expectedEvictedPodCount: 4,
143143
},
144-
{
145-
name: "test-one-evictions-use-gracePeriodSeconds",
146-
policy: tooManyRestartsPolicy(testNamespace.Name, 3, true, 60),
147-
enableGracePeriod: true,
148-
expectedEvictedPodCount: 4,
149-
},
150144
}
151145
for _, tc := range tests {
152146
t.Run(tc.name, func(t *testing.T) {
@@ -204,31 +198,6 @@ func TestTooManyRestarts(t *testing.T) {
204198
if len(deschedulerPods) != 0 {
205199
deschedulerPodName = deschedulerPods[0].Name
206200
}
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-
232201
// Run RemovePodsHavingTooManyRestarts strategy
233202
if err := wait.PollUntilContextTimeout(ctx, 1*time.Second, 50*time.Second, true, func(ctx context.Context) (bool, error) {
234203
currentRunNames := sets.NewString(getCurrentPodNames(ctx, clientSet, testNamespace.Name, t)...)

0 commit comments

Comments
 (0)