Don't mark job as failed until expectations are satisfied
Change-Id: I99206f35f6f145054c005ab362c792e71b9b15f4
This commit is contained in:
@@ -196,6 +196,9 @@ func TestControllerSyncJob(t *testing.T) {
|
||||
wasSuspended bool
|
||||
suspend bool
|
||||
|
||||
// If set, it means that the case is exclusive to tracking with/without finalizers.
|
||||
wFinalizersExclusive *bool
|
||||
|
||||
// pod setup
|
||||
podControllerError error
|
||||
jobKeyForget bool
|
||||
@@ -480,6 +483,16 @@ func TestControllerSyncJob(t *testing.T) {
|
||||
expectedConditionReason: "BackoffLimitExceeded",
|
||||
expectedPodPatches: 1,
|
||||
},
|
||||
"job failures, unsatisfied expectations": {
|
||||
wFinalizersExclusive: pointer.Bool(true),
|
||||
parallelism: 2,
|
||||
completions: 5,
|
||||
deleting: true,
|
||||
failedPods: 1,
|
||||
fakeExpectationAtCreation: 1,
|
||||
expectedFailed: 1,
|
||||
expectedPodPatches: 1,
|
||||
},
|
||||
"indexed job start": {
|
||||
parallelism: 2,
|
||||
completions: 5,
|
||||
@@ -706,6 +719,9 @@ func TestControllerSyncJob(t *testing.T) {
|
||||
if wFinalizers && tc.podControllerError != nil {
|
||||
t.Skip("Can't track status if finalizers can't be removed")
|
||||
}
|
||||
if tc.wFinalizersExclusive != nil && *tc.wFinalizersExclusive != wFinalizers {
|
||||
t.Skipf("Test is exclusive for wFinalizers=%t", *tc.wFinalizersExclusive)
|
||||
}
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.JobReadyPods, tc.jobReadyPodsEnabled)()
|
||||
defer featuregatetesting.SetFeatureGateDuringTest(t, feature.DefaultFeatureGate, features.JobTrackingWithFinalizers, wFinalizers)()
|
||||
|
||||
|
Reference in New Issue
Block a user