refactor: make internals easier to test and add unit tests #2

Merged
Emmanuel BENOîT merged 13 commits from tseeker/gomonop:20240719-more-tests into master 2024-07-20 10:01:05 +02:00
2 changed files with 19 additions and 18 deletions
Showing only changes of commit ebdb99be8b - Show all commits

View file

@ -11,24 +11,6 @@ import (
"nocternity.net/gomonop/pkg/perfdata"
)
// Status represents the return status of the monitoring plugin. The
// corresponding integer value will be used as the program's exit code,
// to be interpreted by the monitoring system.
type Status int
// Plugin exit statuses.
const (
OK Status = iota
WARNING
CRITICAL
UNKNOWN
)
// String representations of the plugin statuses.
func (s Status) String() string {
return [...]string{"OK", "WARNING", "ERROR", "UNKNOWN"}[s]
}
// Plugin represents the monitoring plugin's state, including its name,
// return status and message, additional lines of text, and performance
// data to be encoded in the output.

19
pkg/plugin/status.go Normal file
View file

@ -0,0 +1,19 @@
package plugin // import nocternity.net/gomonop/pkg/perfdata
// Status represents the return status of the monitoring plugin. The
// corresponding integer value will be used as the program's exit code,
// to be interpreted by the monitoring system.
type Status int
// Plugin exit statuses.
const (
OK Status = iota
WARNING
CRITICAL
UNKNOWN
)
// String representations of the plugin statuses.
func (s Status) String() string {
return [...]string{"OK", "WARNING", "ERROR", "UNKNOWN"}[s]
}