mirror of
https://github.com/TwiN/gatus.git
synced 2024-12-14 11:58:04 +00:00
Improve test coverage
This commit is contained in:
parent
7dc200d887
commit
20515b5dd4
2 changed files with 20 additions and 0 deletions
|
@ -298,3 +298,10 @@ func TestLoadFileThatDoesNotExist(t *testing.T) {
|
|||
t.Error("Should've returned an error, because the file specified doesn't exist")
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadDefaultConfigurationFile(t *testing.T) {
|
||||
err := LoadDefaultConfiguration()
|
||||
if err == nil {
|
||||
t.Error("Should've returned an error, because there's no configuration files at the default path nor the default fallback path")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ func TestService_ValidateAndSetDefaults(t *testing.T) {
|
|||
Name: "TwiNNatioN",
|
||||
Url: "https://twinnation.org/health",
|
||||
Conditions: []*Condition{&condition},
|
||||
Alerts: []*Alert{{Type: PagerDutyAlert}},
|
||||
}
|
||||
service.ValidateAndSetDefaults()
|
||||
if service.Method != "GET" {
|
||||
|
@ -60,4 +61,16 @@ func TestService_ValidateAndSetDefaults(t *testing.T) {
|
|||
if service.Headers == nil {
|
||||
t.Error("Service headers should've defaulted to an empty map")
|
||||
}
|
||||
if len(service.Alerts) != 1 {
|
||||
t.Error("Service should've had 1 alert")
|
||||
}
|
||||
if service.Alerts[0].Enabled {
|
||||
t.Error("Service alert should've defaulted to disabled")
|
||||
}
|
||||
if service.Alerts[0].SuccessThreshold != 2 {
|
||||
t.Error("Service alert should've defaulted to a success threshold of 2")
|
||||
}
|
||||
if service.Alerts[0].FailureThreshold != 3 {
|
||||
t.Error("Service alert should've defaulted to a failure threshold of 3")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue