mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Add default pollSettings adjustment routines
Add the default function per resource to override the `pollSettings` which will be re-used where it's needed. Signed-off-by: Dennis Chen <dennis.chen@arm.com>
This commit is contained in:
parent
f12574891c
commit
ee6959addc
1 changed files with 34 additions and 0 deletions
|
@ -3,7 +3,9 @@ package swarm
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"runtime"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
|
@ -12,6 +14,7 @@ import (
|
||||||
"github.com/docker/docker/integration-cli/daemon"
|
"github.com/docker/docker/integration-cli/daemon"
|
||||||
"github.com/docker/docker/internal/test/environment"
|
"github.com/docker/docker/internal/test/environment"
|
||||||
"github.com/gotestyourself/gotestyourself/assert"
|
"github.com/gotestyourself/gotestyourself/assert"
|
||||||
|
"github.com/gotestyourself/gotestyourself/poll"
|
||||||
"github.com/gotestyourself/gotestyourself/skip"
|
"github.com/gotestyourself/gotestyourself/skip"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -20,6 +23,37 @@ const (
|
||||||
defaultSwarmPort = 2477
|
defaultSwarmPort = 2477
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// ServicePoll tweaks the pollSettings for `service`
|
||||||
|
func ServicePoll(config *poll.Settings) {
|
||||||
|
// Override the default pollSettings for `service` resource here ...
|
||||||
|
|
||||||
|
if runtime.GOARCH == "arm64" || runtime.GOARCH == "arm" {
|
||||||
|
config.Timeout = 1 * time.Minute
|
||||||
|
config.Delay = 100 * time.Millisecond
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// NetworkPoll tweaks the pollSettings for `network`
|
||||||
|
func NetworkPoll(config *poll.Settings) {
|
||||||
|
// Override the default pollSettings for `network` resource here ...
|
||||||
|
config.Timeout = 30 * time.Second
|
||||||
|
config.Delay = 100 * time.Millisecond
|
||||||
|
|
||||||
|
if runtime.GOARCH == "arm64" || runtime.GOARCH == "arm" {
|
||||||
|
config.Timeout = 50 * time.Second
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ContainerPoll tweaks the pollSettings for `container`
|
||||||
|
func ContainerPoll(config *poll.Settings) {
|
||||||
|
// Override the default pollSettings for `container` resource here ...
|
||||||
|
|
||||||
|
if runtime.GOARCH == "arm64" || runtime.GOARCH == "arm" {
|
||||||
|
config.Timeout = 30 * time.Second
|
||||||
|
config.Delay = 100 * time.Millisecond
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// NewSwarm creates a swarm daemon for testing
|
// NewSwarm creates a swarm daemon for testing
|
||||||
func NewSwarm(t *testing.T, testEnv *environment.Execution) *daemon.Swarm {
|
func NewSwarm(t *testing.T, testEnv *environment.Execution) *daemon.Swarm {
|
||||||
skip.IfCondition(t, testEnv.IsRemoteDaemon())
|
skip.IfCondition(t, testEnv.IsRemoteDaemon())
|
||||||
|
|
Loading…
Reference in a new issue