Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
more general success determination, typo
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis committed Feb 22, 2018
1 parent 56bae92 commit 76e3c6c
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/e2e/kubernetes/job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ type List struct {
// Job is used to parse data from kubectl get jobs
type Job struct {
Metadata pod.Metadata `json:"metadata"`
Spec pod.Spec `json:"spec"`
Spec Spec `json:"spec"`
Status Status `json:"status"`
}

// Spec holds job spec metadata
type Spec struct {
Completions int `json:"completions"`
Parallelism int `json:"parallelism"`
}

// Status holds job status information
type Status struct {
Active int `json:"active"`
Expand Down Expand Up @@ -97,9 +103,9 @@ func AreAllJobsCompleted(jobPrefix, namespace string) (bool, error) {
return false, err
}
if matched {
if job.Status.Active == 1 {
if job.Status.Active > 0 {
status = append(status, false)
} else if job.Status.Succeeded == 1 {
} else if job.Status.Succeeded == job.Spec.Completions {
status = append(status, true)
}
}
Expand Down Expand Up @@ -154,7 +160,7 @@ func (j *Job) WaitOnReady(sleep, duration time.Duration) (bool, error) {
return WaitOnReady(j.Metadata.Name, j.Metadata.Namespace, sleep, duration)
}

// Delete will delete a Pod in a given namespace
// Delete will delete a Job in a given namespace
func (j *Job) Delete() error {
cmd := exec.Command("kubectl", "delete", "job", "-n", j.Metadata.Namespace, j.Metadata.Name)
util.PrintCommand(cmd)
Expand Down

0 comments on commit 76e3c6c

Please sign in to comment.