d7a013b6f5
The CLI helpers in the rescheduling test were intended for shared use, but until some other tests were written we didn't want to waste time making them generic. This changeset refactors them and adds some new helpers associated with the node drain tests (under separate PR).
26 lines
570 B
Go
26 lines
570 B
Go
package e2eutil
|
|
|
|
import "time"
|
|
|
|
// WaitConfig is an interval and wait time that can be passed to a waiter
|
|
// function, but with a default value that comes from the OrDefault method
|
|
// if the config is nil
|
|
type WaitConfig struct {
|
|
Interval time.Duration
|
|
Retries int64
|
|
}
|
|
|
|
// Return a default wait config of 10s
|
|
func (wc *WaitConfig) OrDefault() (time.Duration, int64) {
|
|
if wc == nil {
|
|
return time.Millisecond * 100, 100
|
|
}
|
|
if wc.Interval == 0 {
|
|
wc.Interval = time.Millisecond * 100
|
|
}
|
|
if wc.Retries == 0 {
|
|
wc.Retries = 100
|
|
}
|
|
return wc.Interval, wc.Retries
|
|
}
|