Skip to content

Commit d36737c

Browse files
authored
Merge pull request kubernetes#130164 from mimowo/deflake-job-integration-test
Deflake the PodReplacementPolicyFeatureToggling Job integration test
2 parents c26c59a + f5e86df commit d36737c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/integration/job/job_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3196,9 +3196,15 @@ func TestJobPodReplacementPolicyFeatureToggling(t *testing.T) {
31963196
Ready: ptr.To[int32](0),
31973197
Active: int(podCount),
31983198
})
3199+
cancel()
31993200
// Disable the controller and turn feature on again.
3201+
// However, before we re-enabling the feature gate we wait a little (1s to
3202+
// wait for the syncJob re-queue after update + 100ms for the syncJob
3203+
// execution itself) to make sure there is no pending syncJob which could
3204+
// panic if the trackTerminating returned false at the start of the sync,
3205+
// but onlyReplaceFailedPods returned true during that sync.
3206+
time.Sleep(time.Second + sleepDurationForControllerLatency)
32003207
featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.JobPodReplacementPolicy, true)
3201-
cancel()
32023208
ctx, cancel = startJobControllerAndWaitForCaches(t, restConfig)
32033209
waitForPodsToBeActive(ctx, t, jobClient, 2, jobObj)
32043210
deletePods(ctx, t, clientSet, jobObj.Namespace)

0 commit comments

Comments
 (0)