Remove failure-threshold property

This commit is contained in:
TwinProduction 2019-10-10 22:42:30 -04:00
parent f979957166
commit 339c1dfb04
5 changed files with 4 additions and 20 deletions

View File

@ -15,7 +15,6 @@ services:
- name: twinnation # Name of your service, can be anything
url: https://twinnation.org/actuator/health
interval: 15s # Duration to wait between every status check (opt. default: 10s)
failure-threshold: 3 # TODO
conditions:
- "$STATUS == 200"
- name: github

View File

@ -2,7 +2,6 @@ services:
- name: twinnation
url: https://twinnation.org/actuator/health
interval: 15s
failure-threshold: 3
conditions:
- "$STATUS == 200"
- name: github

View File

@ -34,9 +34,6 @@ func ParseConfigBytes(yamlBytes []byte) *Config {
config = &Config{}
yaml.Unmarshal(yamlBytes, config)
for _, service := range config.Services {
if service.FailureThreshold == 0 {
service.FailureThreshold = 1
}
if service.Interval == 0 {
service.Interval = 10 * time.Second
}

View File

@ -12,7 +12,6 @@ services:
- name: twinnation
url: https://twinnation.org/actuator/health
interval: 15s
failure-threshold: 3
conditions:
- "$STATUS == 200"
- name: github
@ -37,12 +36,6 @@ services:
if config.Services[1].Interval != 10*time.Second {
t.Errorf("Interval should have been %s, because it is the default value", 10*time.Second)
}
if config.Services[0].FailureThreshold != 3 {
t.Errorf("FailureThreshold should have been %d", 3)
}
if config.Services[1].FailureThreshold != 1 {
t.Errorf("FailureThreshold should have been %d, because it is the default value", 1)
}
if len(config.Services[0].Conditions) != 1 {
t.Errorf("There should have been %d conditions", 1)
}
@ -65,7 +58,4 @@ services:
if config.Services[0].Interval != 10*time.Second {
t.Errorf("Interval should have been %s, because it is the default value", 10*time.Second)
}
if config.Services[0].FailureThreshold != 1 {
t.Errorf("FailureThreshold should have been %d, because it is the default value", 1)
}
}

View File

@ -33,11 +33,10 @@ type Result struct {
}
type Service struct {
Name string `yaml:"name"`
Url string `yaml:"url"`
Interval time.Duration `yaml:"interval,omitempty"`
FailureThreshold int `yaml:"failure-threshold,omitempty"` // TODO: Implement
Conditions []*Condition `yaml:"conditions"`
Name string `yaml:"name"`
Url string `yaml:"url"`
Interval time.Duration `yaml:"interval,omitempty"`
Conditions []*Condition `yaml:"conditions"`
}
func (service *Service) getIp(result *Result) {