Skip to content

Commit

Permalink
Test case when job-2 depends on job-1 and job-3 depends on job-2
Browse files Browse the repository at this point in the history
  • Loading branch information
andreyvelich committed Jan 6, 2025
1 parent 725e7d9 commit bf743bb
Showing 1 changed file with 53 additions and 2 deletions.
55 changes: 53 additions & 2 deletions pkg/webhooks/jobset_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1489,7 +1489,7 @@ func TestValidateCreate(t *testing.T) {

dependsOnTests := []validationTestCase{
{
name: "dependsOn is valid",
name: "DependsOn is valid since job-2 depends on job-1 and job-3 depends on job-1",
js: &jobset.JobSet{
ObjectMeta: validObjectMeta,
Spec: jobset.JobSetSpec{
Expand Down Expand Up @@ -1540,7 +1540,58 @@ func TestValidateCreate(t *testing.T) {
want: errors.Join(),
},
{
name: "job-2 depends on job-3",
name: "DependsOn is valid since job-2 depends on job-1 and job-3 depends on job-2",
js: &jobset.JobSet{
ObjectMeta: validObjectMeta,
Spec: jobset.JobSetSpec{
SuccessPolicy: &jobset.SuccessPolicy{},
ReplicatedJobs: []jobset.ReplicatedJob{
{
Name: "job-1",
Replicas: 1,
Template: batchv1.JobTemplateSpec{
Spec: batchv1.JobSpec{
Template: validPodTemplateSpec,
},
},
},
{
Name: "job-2",
DependsOn: []jobset.DependsOn{
{
Name: "job-1",
Status: "Complete",
},
},
Replicas: 1,
Template: batchv1.JobTemplateSpec{
Spec: batchv1.JobSpec{
Template: validPodTemplateSpec,
},
},
},
{
Name: "job-3",
DependsOn: []jobset.DependsOn{
{
Name: "job-2",
Status: "Complete",
},
},
Replicas: 1,
Template: batchv1.JobTemplateSpec{
Spec: batchv1.JobSpec{
Template: validPodTemplateSpec,
},
},
},
},
},
},
want: errors.Join(),
},
{
name: "DependsOn is invalid since job-2 depends on job-3",
js: &jobset.JobSet{
ObjectMeta: validObjectMeta,
Spec: jobset.JobSetSpec{
Expand Down

0 comments on commit bf743bb

Please sign in to comment.