@@ -291,6 +291,7 @@ func TestControllerSyncJob(t *testing.T) {
291
291
podIndexLabelDisabled bool
292
292
jobPodReplacementPolicy bool
293
293
jobPodFailurePolicy bool
294
+ jobSuccessPolicy bool
294
295
}{
295
296
"job start" : {
296
297
parallelism : 2 ,
@@ -1187,6 +1188,38 @@ func TestControllerSyncJob(t *testing.T) {
1187
1188
},
1188
1189
},
1189
1190
},
1191
+ "SuccessCriteriaMet=False condition added manually is ignored" : {
1192
+ jobSuccessPolicy : true ,
1193
+ parallelism : 1 ,
1194
+ completions : 1 ,
1195
+ activePods : 1 ,
1196
+ readyPods : 1 ,
1197
+ initialStatus : & jobInitialStatus {
1198
+ active : 1 ,
1199
+ startTime : func () * time.Time {
1200
+ now := time .Now ()
1201
+ return & now
1202
+ }(),
1203
+ conditions : []batch.JobCondition {
1204
+ {
1205
+ Type : batch .JobSuccessCriteriaMet ,
1206
+ Status : v1 .ConditionFalse ,
1207
+ Reason : "ConditionAddedManually" ,
1208
+ Message : "Testing" ,
1209
+ },
1210
+ },
1211
+ },
1212
+ expectedActive : 1 ,
1213
+ expectedReady : ptr.To [int32 ](1 ),
1214
+ expectedConditions : []batch.JobCondition {
1215
+ {
1216
+ Type : batch .JobSuccessCriteriaMet ,
1217
+ Status : v1 .ConditionFalse ,
1218
+ Reason : "ConditionAddedManually" ,
1219
+ Message : "Testing" ,
1220
+ },
1221
+ },
1222
+ },
1190
1223
}
1191
1224
1192
1225
for name , tc := range testCases {
@@ -1195,6 +1228,7 @@ func TestControllerSyncJob(t *testing.T) {
1195
1228
featuregatetesting .SetFeatureGateDuringTest (t , feature .DefaultFeatureGate , features .PodIndexLabel , ! tc .podIndexLabelDisabled )
1196
1229
featuregatetesting .SetFeatureGateDuringTest (t , feature .DefaultFeatureGate , features .JobPodReplacementPolicy , tc .jobPodReplacementPolicy )
1197
1230
featuregatetesting .SetFeatureGateDuringTest (t , feature .DefaultFeatureGate , features .JobPodFailurePolicy , tc .jobPodFailurePolicy )
1231
+ featuregatetesting .SetFeatureGateDuringTest (t , feature .DefaultFeatureGate , features .JobSuccessPolicy , tc .jobSuccessPolicy )
1198
1232
// job manager setup
1199
1233
clientSet := clientset .NewForConfigOrDie (& restclient.Config {Host : "" , ContentConfig : restclient.ContentConfig {GroupVersion : & schema.GroupVersion {Group : "" , Version : "v1" }}})
1200
1234
0 commit comments