From 97f6564c1e44ddd38d422e6899a6daf2110827f0 Mon Sep 17 00:00:00 2001 From: Jason Kulatunga Date: Mon, 2 May 2022 10:26:25 -0700 Subject: [PATCH] adding documetnation for smartctl exit codes and addl test. --- collector/pkg/collector/base.go | 1 + collector/pkg/config/config_test.go | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/collector/pkg/collector/base.go b/collector/pkg/collector/base.go index ff1801f..3d4bdc9 100644 --- a/collector/pkg/collector/base.go +++ b/collector/pkg/collector/base.go @@ -40,6 +40,7 @@ func (c *BaseCollector) postJson(url string, body interface{}, target interface{ return json.NewDecoder(r.Body).Decode(target) } +// http://www.linuxguide.it/command_line/linux-manpage/do.php?file=smartctl#sect7 func (c *BaseCollector) LogSmartctlExitCode(exitCode int) { if exitCode&0x01 != 0 { c.logger.Errorln("smartctl could not parse commandline") diff --git a/collector/pkg/config/config_test.go b/collector/pkg/config/config_test.go index 1e8fd6d..8511c14 100644 --- a/collector/pkg/config/config_test.go +++ b/collector/pkg/config/config_test.go @@ -8,6 +8,19 @@ import ( "testing" ) +func TestConfiguration_InvalidConfigPath(t *testing.T) { + t.Parallel() + + //setup + testConfig, _ := config.Create() + + //test + err := testConfig.ReadConfig("does_not_exist.yaml") + + //assert + require.Error(t, err, "should return an error") +} + func TestConfiguration_GetScanOverrides_Simple(t *testing.T) { t.Parallel()