diff --git a/pkg/analyze/longhorn.go b/pkg/analyze/longhorn.go index f780328a..c8785099 100644 --- a/pkg/analyze/longhorn.go +++ b/pkg/analyze/longhorn.go @@ -247,15 +247,16 @@ func analyzeLonghornReplicaChecksums(volumeName string, checksums []map[string]s // Keep warn/error results. Return a single pass result if there are no warn/errors. func simplifyLonghornResults(results []*AnalyzeResult) []*AnalyzeResult { out := []*AnalyzeResult{} - + resultPass := false for _, result := range results { if result.IsPass { + resultPass = true continue } out = append(out, result) } - if len(out) == 0 { + if resultPass && len(out) == 0 { out = append(out, &AnalyzeResult{ Title: "Longhorn Health Status", IsPass: true, diff --git a/pkg/analyze/longhorn_test.go b/pkg/analyze/longhorn_test.go index 9dccdd5f..be67c191 100644 --- a/pkg/analyze/longhorn_test.go +++ b/pkg/analyze/longhorn_test.go @@ -411,6 +411,11 @@ func TestSimplifyLonghornResults(t *testing.T) { }, }, }, + { + name: "No Results", + input: []*AnalyzeResult{}, + expect: []*AnalyzeResult{}, + }, { name: "Mixed results", input: []*AnalyzeResult{