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