Skip to content

Commit 2977f8f

Browse files
authored
Stop longhorn false positives on no results. (#397)
Longhorn analyzer no longer report positive results on no results
1 parent bf7d658 commit 2977f8f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pkg/analyze/longhorn.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,15 +247,16 @@ func analyzeLonghornReplicaChecksums(volumeName string, checksums []map[string]s
247247
// Keep warn/error results. Return a single pass result if there are no warn/errors.
248248
func simplifyLonghornResults(results []*AnalyzeResult) []*AnalyzeResult {
249249
out := []*AnalyzeResult{}
250-
250+
resultPass := false
251251
for _, result := range results {
252252
if result.IsPass {
253+
resultPass = true
253254
continue
254255
}
255256
out = append(out, result)
256257
}
257258

258-
if len(out) == 0 {
259+
if resultPass && len(out) == 0 {
259260
out = append(out, &AnalyzeResult{
260261
Title: "Longhorn Health Status",
261262
IsPass: true,

pkg/analyze/longhorn_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,11 @@ func TestSimplifyLonghornResults(t *testing.T) {
411411
},
412412
},
413413
},
414+
{
415+
name: "No Results",
416+
input: []*AnalyzeResult{},
417+
expect: []*AnalyzeResult{},
418+
},
414419
{
415420
name: "Mixed results",
416421
input: []*AnalyzeResult{

0 commit comments

Comments
 (0)