diff --git a/pkg/analyze/analyzer.go b/pkg/analyze/analyzer.go index 185d06fdb..0d6f4e681 100644 --- a/pkg/analyze/analyzer.go +++ b/pkg/analyze/analyzer.go @@ -18,6 +18,8 @@ import ( "k8s.io/klog/v2" ) +const FILE_NOT_COLLECTED = "fileNotCollected" + type AnalyzeResult struct { IsPass bool IsFail bool diff --git a/pkg/analyze/host_filesystem_performance.go b/pkg/analyze/host_filesystem_performance.go index 9eb99342a..31120b020 100644 --- a/pkg/analyze/host_filesystem_performance.go +++ b/pkg/analyze/host_filesystem_performance.go @@ -44,21 +44,21 @@ func (a *AnalyzeHostFilesystemPerformance) Analyze( contents, err := getCollectedFileContents(name) if err != nil { if len(hostAnalyzer.Outcomes) >= 1 { - // if the very first outcome is 'fileNotCollected', then use that outcome + // if the very first outcome is FILE_NOT_COLLECTED', then use that outcome // otherwise, return the error - if hostAnalyzer.Outcomes[0].Fail != nil && hostAnalyzer.Outcomes[0].Fail.When == "fileNotCollected" { + if hostAnalyzer.Outcomes[0].Fail != nil && hostAnalyzer.Outcomes[0].Fail.When == FILE_NOT_COLLECTED { result.IsFail = true result.Message = renderFSPerfOutcome(hostAnalyzer.Outcomes[0].Fail.Message, collect.FSPerfResults{}) result.URI = hostAnalyzer.Outcomes[0].Fail.URI return []*AnalyzeResult{result}, nil } - if hostAnalyzer.Outcomes[0].Warn != nil && hostAnalyzer.Outcomes[0].Warn.When == "fileNotCollected" { + if hostAnalyzer.Outcomes[0].Warn != nil && hostAnalyzer.Outcomes[0].Warn.When == FILE_NOT_COLLECTED { result.IsWarn = true result.Message = renderFSPerfOutcome(hostAnalyzer.Outcomes[0].Warn.Message, collect.FSPerfResults{}) result.URI = hostAnalyzer.Outcomes[0].Warn.URI return []*AnalyzeResult{result}, nil } - if hostAnalyzer.Outcomes[0].Pass != nil && hostAnalyzer.Outcomes[0].Pass.When == "fileNotCollected" { + if hostAnalyzer.Outcomes[0].Pass != nil && hostAnalyzer.Outcomes[0].Pass.When == FILE_NOT_COLLECTED { result.IsPass = true result.Message = renderFSPerfOutcome(hostAnalyzer.Outcomes[0].Pass.Message, collect.FSPerfResults{}) result.URI = hostAnalyzer.Outcomes[0].Pass.URI @@ -158,7 +158,7 @@ func (a *AnalyzeHostFilesystemPerformance) Analyze( } func compareHostFilesystemPerformanceConditionalToActual(conditional string, fsPerf collect.FSPerfResults) (res bool, err error) { - if conditional == "fileNotCollected" { + if conditional == FILE_NOT_COLLECTED { return false, nil }