fix(parsers.nagios): nagios parser now uses real error for logging #10472 (#10473)

This commit is contained in:
Sakerdotes 2022-01-20 18:42:40 +01:00 committed by GitHub
parent 61214bd33b
commit 83ab2b8bb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -28,7 +28,7 @@ func getExitCode(err error) (int, error) {
// If it is not an *exec.ExitError, then it must be
// an io error, but docs do not say anything about the
// exit code in this case.
return 0, errors.New("expected *exec.ExitError")
return 0, err
}
ws, ok := ee.Sys().(syscall.WaitStatus)

View File

@ -33,7 +33,7 @@ func TestGetExitCode(t *testing.T) {
return errors.New("I am not *exec.ExitError")
},
expCode: 0,
expErr: errors.New("expected *exec.ExitError"),
expErr: errors.New("I am not *exec.ExitError"),
},
}
@ -177,7 +177,7 @@ func TestTryAddState(t *testing.T) {
n("nagios").
f("perfdata", 0).b(),
}
expErr := "exec: get exit code: expected *exec.ExitError"
expErr := "exec: get exit code: non parsable error"
assertEqual(t, exp, metrics)
require.Equal(t, expErr, err.Error())