mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-21 23:43:27 +01:00
Add tests for "metrics" config property
This commit is contained in:
parent
e162740654
commit
b08e563b2a
@ -58,6 +58,32 @@ services:
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error("No error should've been returned")
|
t.Error("No error should've been returned")
|
||||||
}
|
}
|
||||||
|
if config.Metrics {
|
||||||
|
t.Error("Metrics should've been false by default")
|
||||||
|
}
|
||||||
|
if config.Services[0].Url != "https://twinnation.org/actuator/health" {
|
||||||
|
t.Errorf("URL should have been %s", "https://twinnation.org/actuator/health")
|
||||||
|
}
|
||||||
|
if config.Services[0].Interval != 10*time.Second {
|
||||||
|
t.Errorf("Interval should have been %s, because it is the default value", 10*time.Second)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestParseAndValidateConfigBytesWithMetrics(t *testing.T) {
|
||||||
|
config, err := parseAndValidateConfigBytes([]byte(`
|
||||||
|
metrics: true
|
||||||
|
services:
|
||||||
|
- name: twinnation
|
||||||
|
url: https://twinnation.org/actuator/health
|
||||||
|
conditions:
|
||||||
|
- "$STATUS == 200"
|
||||||
|
`))
|
||||||
|
if err != nil {
|
||||||
|
t.Error("No error should've been returned")
|
||||||
|
}
|
||||||
|
if !config.Metrics {
|
||||||
|
t.Error("Metrics should have been true")
|
||||||
|
}
|
||||||
if config.Services[0].Url != "https://twinnation.org/actuator/health" {
|
if config.Services[0].Url != "https://twinnation.org/actuator/health" {
|
||||||
t.Errorf("URL should have been %s", "https://twinnation.org/actuator/health")
|
t.Errorf("URL should have been %s", "https://twinnation.org/actuator/health")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user