Skip to content

Commit 1bc7d44

Browse files
fix(test): update job to indexed job.
Signed-off-by: Electronic-Waste <[email protected]>
1 parent 674a05d commit 1bc7d44

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

pkg/controller.v1beta1/trial/trial_controller_test.go

+14-1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const (
5757

5858
var (
5959
startTime = time.Now()
60+
completionTime = time.Now().Add(time.Second)
6061
batchJobKey = types.NamespacedName{Name: batchJobName, Namespace: namespace}
6162
observationLogAvailable = &api_pb.GetObservationLogReply{
6263
ObservationLog: &api_pb.ObservationLog{
@@ -218,7 +219,8 @@ func TestReconcileBatchJob(t *testing.T) {
218219
Reason: batchJobCompleteReason,
219220
},
220221
},
221-
StartTime: &metav1.Time{Time: startTime},
222+
StartTime: &metav1.Time{Time: startTime},
223+
CompletionTime: &metav1.Time{Time: completionTime},
222224
}
223225
g.Expect(c.Status().Update(ctx, batchJob)).NotTo(gomega.HaveOccurred())
224226

@@ -465,6 +467,17 @@ func newFakeTrialBatchJob(mcType commonv1beta1.CollectorKind, trialName string)
465467
Namespace: namespace,
466468
},
467469
Spec: batchv1.JobSpec{
470+
CompletionMode: ptr.To(batchv1.IndexedCompletion),
471+
Completions: ptr.To(int32(1)),
472+
Parallelism: ptr.To(int32(1)),
473+
SuccessPolicy: &batchv1.SuccessPolicy{
474+
Rules: []batchv1.SuccessPolicyRule{
475+
{
476+
SucceededIndexes: ptr.To("0"),
477+
SucceededCount: ptr.To(int32(1)),
478+
},
479+
},
480+
},
468481
Template: corev1.PodTemplateSpec{
469482
Spec: corev1.PodSpec{
470483
Containers: []corev1.Container{

0 commit comments

Comments
 (0)