diff --git a/pkg/checksdb/check.go b/pkg/checksdb/check.go index 2ed993c62..e0a0b921c 100644 --- a/pkg/checksdb/check.go +++ b/pkg/checksdb/check.go @@ -45,8 +45,8 @@ type Check struct { Result CheckResult CapturedOutput string - Details string - SkipReason string + details string + skipReason string logger *log.Logger logArchive *strings.Builder @@ -190,7 +190,7 @@ func (check *Check) SetResult(compliantObjects, nonCompliantObjects []*testhelpe check.LogError("Failed to get result objects string for check %s: %v", check.ID, err) } - check.Details = resultObjectsStr + check.details = resultObjectsStr // If an error/panic happened before, do not change the result. if check.Result == CheckResultError { @@ -199,27 +199,15 @@ func (check *Check) SetResult(compliantObjects, nonCompliantObjects []*testhelpe if len(nonCompliantObjects) > 0 { check.Result = CheckResultFailed - check.SkipReason = resultObjectsStr + check.skipReason = "" } else if len(compliantObjects) == 0 { // Mark this check as skipped. check.LogWarn("Check %s marked as skipped as both compliant and non-compliant objects lists are empty.", check.ID) - check.SkipReason = "Compliant and non-compliant objects lists are empty." + check.skipReason = "Compliant and non-compliant objects lists are empty." check.Result = CheckResultSkipped } } -func (check *Check) SetResultFailed(reason string) { - check.mutex.Lock() - defer check.mutex.Unlock() - - if check.Result == CheckResultAborted { - return - } - - check.Result = CheckResultFailed - check.SkipReason = reason -} - func (check *Check) SetResultSkipped(reason string) { check.mutex.Lock() defer check.mutex.Unlock() @@ -229,7 +217,7 @@ func (check *Check) SetResultSkipped(reason string) { } check.Result = CheckResultSkipped - check.SkipReason = reason + check.skipReason = reason } func (check *Check) SetResultError(reason string) { @@ -245,7 +233,7 @@ func (check *Check) SetResultError(reason string) { return } check.Result = CheckResultError - check.SkipReason = reason + check.skipReason = reason } func (check *Check) SetResultAborted(reason string) { @@ -253,7 +241,7 @@ func (check *Check) SetResultAborted(reason string) { defer check.mutex.Unlock() check.Result = CheckResultAborted - check.SkipReason = reason + check.skipReason = reason } func (check *Check) Run() error { diff --git a/pkg/checksdb/checksdb.go b/pkg/checksdb/checksdb.go index b721996fb..49917059e 100644 --- a/pkg/checksdb/checksdb.go +++ b/pkg/checksdb/checksdb.go @@ -123,9 +123,9 @@ func recordCheckResult(check *Check) { StartTime: check.StartTime.String(), EndTime: check.EndTime.String(), Duration: int(check.EndTime.Sub(check.StartTime).Seconds()), - SkipReason: check.SkipReason, + SkipReason: check.skipReason, CapturedTestOutput: check.GetLogs(), - CheckDetails: check.Details, + CheckDetails: check.details, CategoryClassification: &claim.CategoryClassification{ Extended: identifiers.Catalog[claimID].CategoryClassification[identifiers.Extended],