Skip to content

Commit

Permalink
fix(test): update job to indexed job.
Browse files Browse the repository at this point in the history
Signed-off-by: Electronic-Waste <2690692950@qq.com>
  • Loading branch information
Electronic-Waste committed Mar 2, 2025
1 parent 674a05d commit 1bc7d44
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion pkg/controller.v1beta1/trial/trial_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const (

var (
startTime = time.Now()
completionTime = time.Now().Add(time.Second)
batchJobKey = types.NamespacedName{Name: batchJobName, Namespace: namespace}
observationLogAvailable = &api_pb.GetObservationLogReply{
ObservationLog: &api_pb.ObservationLog{
Expand Down Expand Up @@ -218,7 +219,8 @@ func TestReconcileBatchJob(t *testing.T) {
Reason: batchJobCompleteReason,
},
},
StartTime: &metav1.Time{Time: startTime},
StartTime: &metav1.Time{Time: startTime},
CompletionTime: &metav1.Time{Time: completionTime},
}
g.Expect(c.Status().Update(ctx, batchJob)).NotTo(gomega.HaveOccurred())

Expand Down Expand Up @@ -465,6 +467,17 @@ func newFakeTrialBatchJob(mcType commonv1beta1.CollectorKind, trialName string)
Namespace: namespace,
},
Spec: batchv1.JobSpec{
CompletionMode: ptr.To(batchv1.IndexedCompletion),
Completions: ptr.To(int32(1)),
Parallelism: ptr.To(int32(1)),
SuccessPolicy: &batchv1.SuccessPolicy{
Rules: []batchv1.SuccessPolicyRule{
{
SucceededIndexes: ptr.To("0"),
SucceededCount: ptr.To(int32(1)),
},
},
},
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
Expand Down

0 comments on commit 1bc7d44

Please # to comment.