Make AlertDown required for a Monitor

This commit is contained in:
Ian Fijolek
2019-10-04 16:23:48 -07:00
parent 6b9edf75d7
commit 1b07059825
2 changed files with 10 additions and 7 deletions
+6 -6
View File
@@ -13,16 +13,16 @@ func TestMonitorIsValid(t *testing.T) {
expected bool
name string
}{
{Monitor{Command: []string{"echo", "test"}}, true, "Command only"},
{Monitor{CommandShell: "echo test"}, true, "CommandShell only"},
{Monitor{}, false, "No commands"},
{Monitor{Command: []string{"echo", "test"}, AlertDown: []string{"log"}}, true, "Command only"},
{Monitor{CommandShell: "echo test", AlertDown: []string{"log"}}, true, "CommandShell only"},
{Monitor{Command: []string{"echo", "test"}}, false, "No AlertDown"},
{Monitor{AlertDown: []string{"log"}}, false, "No commands"},
{
Monitor{Command: []string{"echo", "test"}, CommandShell: "echo test"},
Monitor{Command: []string{"echo", "test"}, CommandShell: "echo test", AlertDown: []string{"log"}},
false,
"Both commands",
},
{Monitor{AlertAfter: -1}, false, "Invalid alert threshold, -1"},
{Monitor{AlertAfter: 0}, false, "Invalid alert threshold, 0"},
{Monitor{Command: []string{"echo", "test"}, AlertDown: []string{"log"}, AlertAfter: -1}, false, "Invalid alert threshold, -1"},
}
for _, c := range cases {