From a0eb194d8141e2f3c66026250847581d89b8e5b0 Mon Sep 17 00:00:00 2001 From: zhangxiaoyu-zidif Date: Sat, 29 Jul 2017 16:06:48 +0800 Subject: [PATCH] Add test items for job utils --- pkg/controller/job/utils_test.go | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pkg/controller/job/utils_test.go b/pkg/controller/job/utils_test.go index bfc84132153..0c2cdfeb566 100644 --- a/pkg/controller/job/utils_test.go +++ b/pkg/controller/job/utils_test.go @@ -46,4 +46,21 @@ func TestIsJobFinished(t *testing.T) { if IsJobFinished(job) { t.Error("Job was not expected to be finished") } + + job.Status.Conditions[0].Type = batch.JobFailed + + job.Status.Conditions[0].Status = v1.ConditionTrue + if !IsJobFinished(job) { + t.Error("Job was expected to be finished") + } + + job.Status.Conditions[0].Status = v1.ConditionFalse + if IsJobFinished(job) { + t.Error("Job was not expected to be finished") + } + + job.Status.Conditions[0].Status = v1.ConditionUnknown + if IsJobFinished(job) { + t.Error("Job was not expected to be finished") + } }