From 76e3c6c9189897c7a8e77b42f70bc481fc761c09 Mon Sep 17 00:00:00 2001 From: Jack Francis Date: Wed, 21 Feb 2018 17:08:46 -0800 Subject: [PATCH] more general success determination, typo --- test/e2e/kubernetes/job/job.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/test/e2e/kubernetes/job/job.go b/test/e2e/kubernetes/job/job.go index db12335e80..00caea57f9 100644 --- a/test/e2e/kubernetes/job/job.go +++ b/test/e2e/kubernetes/job/job.go @@ -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"` @@ -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) } } @@ -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)