From 1555268e66faec3d8ff4d6f25b97bb4275a510d9 Mon Sep 17 00:00:00 2001 From: gmhdbjd Date: Thu, 4 Jun 2020 14:39:43 +0800 Subject: [PATCH 1/2] do not show successful pre-check items if fail --- checker/checker.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/checker/checker.go b/checker/checker.go index ff922ebbaa..b17105a570 100644 --- a/checker/checker.go +++ b/checker/checker.go @@ -255,6 +255,15 @@ func (c *Checker) Process(ctx context.Context, pr chan pb.ProcessResult) { errs = append(errs, unit.NewProcessError(pb.ErrorType_CheckFailed, err)) } else if !result.Summary.Passed { errs = append(errs, unit.NewProcessError(pb.ErrorType_CheckFailed, errors.New("check was failed, please see detail"))) + + // only return fail result if not pass + failResults := result.Results[:0] + for _, r := range result.Results { + if r.State == check.StateFailure { + failResults = append(failResults, r) + } + } + result.Results = failResults } c.updateInstruction(result) From 3b9184a4e48f87f3530df4fa63587bc15d6ec7eb Mon Sep 17 00:00:00 2001 From: gmhdbjd Date: Fri, 5 Jun 2020 16:20:03 +0800 Subject: [PATCH 2/2] also return warn result --- checker/checker.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/checker/checker.go b/checker/checker.go index b17105a570..99774176f8 100644 --- a/checker/checker.go +++ b/checker/checker.go @@ -256,14 +256,14 @@ func (c *Checker) Process(ctx context.Context, pr chan pb.ProcessResult) { } else if !result.Summary.Passed { errs = append(errs, unit.NewProcessError(pb.ErrorType_CheckFailed, errors.New("check was failed, please see detail"))) - // only return fail result if not pass - failResults := result.Results[:0] + // remove success result if not pass + results := result.Results[:0] for _, r := range result.Results { - if r.State == check.StateFailure { - failResults = append(failResults, r) + if r.State != check.StateSuccess { + results = append(results, r) } } - result.Results = failResults + result.Results = results } c.updateInstruction(result)