Skip to content

Commit

Permalink
add error exit code e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
hzxuzhonghu committed Apr 9, 2019
1 parent ac55152 commit 71db77b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/e2e/job_error_handling.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,4 +469,42 @@ var _ = Describe("Job Error Handling", func() {

})

It("job level LifecyclePolicy, error code: 3; Action: RestartJob", func() {
By("init test context")
context := initTestContext()
defer cleanupTestContext(context)

By("create job")
var erroCode int32 = 3
job := createJob(context, &jobSpec{
name: "errorcode-restart-job",
policies: []vkv1.LifecyclePolicy{
{
Action: vkv1.RestartJobAction,
ExitCode: &erroCode,
},
},
tasks: []taskSpec{
{
name: "success",
img: defaultNginxImage,
min: 1,
rep: 1,
},
{
name: "fail",
img: defaultNginxImage,
min: 1,
rep: 1,
command: "sleep 10s && exit 3",
restartPolicy: v1.RestartPolicyNever,
},
},
})

// job phase: pending -> running -> restarting
err := waitJobPhases(context, job, []vkv1.JobPhase{vkv1.Pending, vkv1.Running, vkv1.Restarting})
Expect(err).NotTo(HaveOccurred())
})

})

0 comments on commit 71db77b

Please sign in to comment.