From 176c10200c098206d852c054e9723841f7870803 Mon Sep 17 00:00:00 2001 From: Dennis Chen Date: Tue, 27 Mar 2018 03:36:55 +0000 Subject: [PATCH] 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 (cherry picked from commit ee6959addc5664a5c55765f2c721f84414ea4779) Signed-off-by: Sebastiaan van Stijn --- .../integration/internal/swarm/service.go | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/components/engine/integration/internal/swarm/service.go b/components/engine/integration/internal/swarm/service.go index 79705961a1..28d367c660 100644 --- a/components/engine/integration/internal/swarm/service.go +++ b/components/engine/integration/internal/swarm/service.go @@ -3,7 +3,9 @@ package swarm import ( "context" "fmt" + "runtime" "testing" + "time" "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" @@ -12,6 +14,7 @@ import ( "github.com/docker/docker/integration-cli/daemon" "github.com/docker/docker/internal/test/environment" "github.com/gotestyourself/gotestyourself/assert" + "github.com/gotestyourself/gotestyourself/poll" "github.com/gotestyourself/gotestyourself/skip" ) @@ -20,6 +23,37 @@ const ( 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 func NewSwarm(t *testing.T, testEnv *environment.Execution) *daemon.Swarm { skip.IfCondition(t, testEnv.IsRemoteDaemon())