Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kannon92 committed Aug 7, 2023
1 parent 12f43ed commit 032acc4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
1 change: 0 additions & 1 deletion pkg/controllers/jobset_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,6 @@ func (r *JobSetReconciler) executeStartupPolicy(ctx context.Context, js *jobset.
counter = counter + 1
}
}
log.V(2).Info("detected startupPolicy, suspend all jobs")
if counter == len(ownedJobs.active) {
if js.ObjectMeta.Annotations == nil {
annotations := make(map[string]string)
Expand Down
32 changes: 32 additions & 0 deletions pkg/controllers/jobset_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,38 @@ func TestConstructJobsFromTemplate(t *testing.T) {
Subdomain(jobSetName).Obj(),
},
},
{
name: "startup-policy",
js: testutils.MakeJobSet(jobSetName, ns).
StartupPolicy(&jobset.StartupPolicy{
TargetReplicatedJobStatuses: []jobset.TargetReplicatedJobStartup{
{
Name: replicatedJobName,
Status: jobset.Succeeded,
},
},
}).
EnableDNSHostnames(true).
NetworkSubdomain(jobSetName).
ReplicatedJob(testutils.MakeReplicatedJob(replicatedJobName).
Job(testutils.MakeJobTemplate(jobName, ns).Obj()).
Subdomain(jobSetName).
Replicas(1).
Obj()).
Obj(),
ownedJobs: &childJobs{},
want: []*batchv1.Job{
makeJob(&makeJobArgs{
jobSetName: jobSetName,
replicatedJobName: replicatedJobName,
jobName: "test-jobset-replicated-job-0",
ns: ns,
replicas: 1,
jobIdx: 0}).
Suspend(true).
Subdomain(jobSetName).Obj(),
},
},
}

for _, tc := range tests {
Expand Down

0 comments on commit 032acc4

Please sign in to comment.