e2e: add PollInterval()

Various different tests all have their own poll intervals. As a start towards
consolidating that, the interval from test/e2e/framework/pod (as one of the
most common cases for polling) is moved into the framework.

Changing other helper packages and tests needs to follow.
This commit is contained in:
Patrick Ohly
2023-01-03 17:55:24 +01:00
parent db394db398
commit 16a6f70e11
2 changed files with 20 additions and 13 deletions

View File

@@ -19,6 +19,7 @@ package framework
import "time"
var defaultTimeouts = TimeoutContext{
Poll: 2 * time.Second, // from the former e2e/framework/pod poll interval
PodStart: 5 * time.Minute,
PodStartShort: 2 * time.Minute,
PodStartSlow: 15 * time.Minute,
@@ -42,6 +43,9 @@ var defaultTimeouts = TimeoutContext{
// TimeoutContext contains timeout settings for several actions.
type TimeoutContext struct {
// Poll is how long to wait between API calls when waiting for some condition.
Poll time.Duration
// PodStart is how long to wait for the pod to be started.
PodStart time.Duration
@@ -111,3 +115,9 @@ func NewTimeoutContext() *TimeoutContext {
copy := TestContext.timeouts
return &copy
}
// PollInterval defines how long to wait between API server queries while
// waiting for some condition.
func PollInterval() time.Duration {
return TestContext.timeouts.Poll
}