Improve test coverage

This commit is contained in:
TwinProduction 2020-12-29 17:27:58 -05:00
parent ddbf391c39
commit bbf39e70fd

View File

@ -249,7 +249,7 @@ func TestIntegrationEvaluateHealthForDNS(t *testing.T) {
func TestIntegrationEvaluateHealthForICMP(t *testing.T) {
conditionSuccess := Condition("[CONNECTED] == true")
service := Service{
Name: "ICMP example",
Name: "ICMP test",
URL: "icmp://127.0.0.1",
Conditions: []*Condition{&conditionSuccess},
}
@ -264,3 +264,17 @@ func TestIntegrationEvaluateHealthForICMP(t *testing.T) {
t.Error("Because all conditions passed, this should have been a success")
}
}
func TestService_getIP(t *testing.T) {
conditionSuccess := Condition("[CONNECTED] == true")
service := Service{
Name: "Invalid URL test",
URL: "",
Conditions: []*Condition{&conditionSuccess},
}
result := &Result{}
service.getIP(result)
if len(result.Errors) == 0 {
t.Error("service.getIP(result) should've thrown an error because the URL is invalid, thus cannot be parsed")
}
}