Refactor test package and some field types

Fairly big test refactor and changing some of the fields from pointers
This commit is contained in:
Ian Fijolek
2024-11-15 11:30:34 -08:00
parent 7c72eabd6b
commit df1c7aa74b
18 changed files with 237 additions and 344 deletions
+6 -2
View File
@@ -113,6 +113,8 @@ func (config *Config) Init() (err error) {
}
for _, monitor := range config.Monitors {
// TODO: Move this to a Monitor.Init() method
// Parse the check_interval string into a time.Duration
if monitor.CheckIntervalStr != nil {
monitor.CheckInterval, err = time.ParseDuration(*monitor.CheckIntervalStr)
@@ -122,8 +124,10 @@ func (config *Config) Init() (err error) {
}
// Set default values for monitor alerts
if monitor.AlertAfter == nil {
monitor.AlertAfter = config.DefaultAlertAfter
if monitor.AlertAfter == 0 && config.DefaultAlertAfter != nil {
monitor.AlertAfter = *config.DefaultAlertAfter
} else if monitor.AlertAfter == 0 {
monitor.AlertAfter = 1
}
if monitor.AlertEvery == nil {