Stop longhorn false positives on no results. (#397)

Longhorn analyzer no longer report positive results on no results
This commit is contained in:
Kyle Sorensen
2021-07-28 09:37:54 -06:00
committed by GitHub
parent bf7d658313
commit 2977f8f0d3
2 changed files with 8 additions and 2 deletions

View File

@@ -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,

View File

@@ -411,6 +411,11 @@ func TestSimplifyLonghornResults(t *testing.T) {
},
},
},
{
name: "No Results",
input: []*AnalyzeResult{},
expect: []*AnalyzeResult{},
},
{
name: "Mixed results",
input: []*AnalyzeResult{