github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/e2eutil/wait.go (about) 1 package e2eutil 2 3 import "time" 4 5 // WaitConfig is an interval and wait time that can be passed to a waiter 6 // function, but with a default value that comes from the OrDefault method 7 // if the config is nil 8 type WaitConfig struct { 9 Interval time.Duration 10 Retries int64 11 } 12 13 // OrDefault returns a default wait config of 10s. 14 func (wc *WaitConfig) OrDefault() (time.Duration, int64) { 15 if wc == nil { 16 return time.Millisecond * 100, 100 17 } 18 if wc.Interval == 0 { 19 wc.Interval = time.Millisecond * 100 20 } 21 if wc.Retries == 0 { 22 wc.Retries = 100 23 } 24 return wc.Interval, wc.Retries 25 }