Skip to content

Commit

Permalink
split refactor from kubectl vaidate
Browse files Browse the repository at this point in the history
  • Loading branch information
danielvegamyhre committed Mar 28, 2024
1 parent e8e75e4 commit a92cd68
Showing 1 changed file with 0 additions and 64 deletions.
64 changes: 0 additions & 64 deletions pkg/webhooks/jobset_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -815,70 +815,6 @@ func TestValidateCreate(t *testing.T) {
fmt.Errorf(podNameTooLongErrorMsg),
),
},
{
name: "missing containers",
js: &jobset.JobSet{
TypeMeta: metav1.TypeMeta{
Kind: "JobSet",
APIVersion: "jobset.x-k8s.io/v1alpha2",
},
ObjectMeta: validObjectMeta,
Spec: jobset.JobSetSpec{
ReplicatedJobs: []jobset.ReplicatedJob{
{
Name: "rj",
Replicas: 1,
Template: batchv1.JobTemplateSpec{
Spec: batchv1.JobSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{},
},
},
},
},
},
SuccessPolicy: &jobset.SuccessPolicy{
Operator: jobset.OperatorAll,
},
},
},
want: errors.Join(
fmt.Errorf(
"spec.replicatedJobs[0].template.spec.template.spec.containers: Invalid value: \"null\": spec.replicatedJobs[0].template.spec.template.spec.containers in body must be of type array",
),
),
},
{
name: "invalid success policy",
js: &jobset.JobSet{
TypeMeta: metav1.TypeMeta{
Kind: "JobSet",
APIVersion: "jobset.x-k8s.io/v1alpha2",
},
ObjectMeta: validObjectMeta,
Spec: jobset.JobSetSpec{
ReplicatedJobs: []jobset.ReplicatedJob{
{
Name: "rj",
Replicas: 1,
Template: batchv1.JobTemplateSpec{
Spec: batchv1.JobSpec{
Template: validPodTemplateSpec,
},
},
},
},
SuccessPolicy: &jobset.SuccessPolicy{
Operator: "InvalidOperator",
},
},
},
want: errors.Join(
fmt.Errorf(
"spec.successPolicy.operator: Unsupported value: \"InvalidOperator\": supported values: \"All\", \"Any\"",
),
),
},
}
fakeClient := fake.NewFakeClient()
webhook, err := NewJobSetWebhook(fakeClient)
Expand Down

0 comments on commit a92cd68

Please sign in to comment.