mirror of
https://github.com/replicatedhq/troubleshoot.git
synced 2026-04-15 07:16:34 +00:00
Stop longhorn false positives on no results. (#397)
Longhorn analyzer no longer report positive results on no results
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -411,6 +411,11 @@ func TestSimplifyLonghornResults(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "No Results",
|
||||
input: []*AnalyzeResult{},
|
||||
expect: []*AnalyzeResult{},
|
||||
},
|
||||
{
|
||||
name: "Mixed results",
|
||||
input: []*AnalyzeResult{
|
||||
|
||||
Reference in New Issue
Block a user