Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve states of partial results recursively and now correctly #107

Merged
merged 1 commit into from Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion result/overall.go
Expand Up @@ -324,7 +324,7 @@ func (s *PartialResult) GetStatus() int {
states := make([]int, len(s.PartialResults))

for i := range s.PartialResults {
states[i] = s.PartialResults[i].state
states[i] = s.PartialResults[i].GetStatus()
}

return WorstState(states...)
Expand Down
6 changes: 3 additions & 3 deletions result/overall_test.go
Expand Up @@ -323,15 +323,15 @@ func TestOverall_withSubchecks_PartialResult(t *testing.T) {

overall.AddSubcheck(subcheck)

res := `states: ok=1
\_ [OK] PartialResult
res := `states: critical=1
\_ [CRITICAL] PartialResult
\_ [CRITICAL] SubSubcheck
\_ [CRITICAL] SubSubSubcheck
|foo=3 bar=300% baz=23B
`

assert.Equal(t, res, overall.GetOutput())
assert.Equal(t, 0, overall.GetStatus())
assert.Equal(t, check.Critical, overall.GetStatus())
}

func TestOverall_withSubchecks_PartialResultStatus(t *testing.T) {
Expand Down