| From 70acc6217805288ae36fa673d6bd4e6a760df08b Mon Sep 17 00:00:00 2001 |
| From: Chenglong Tang <chenglongtang@google.com> |
| Date: Tue, 10 Dec 2024 19:25:19 +0000 |
| Subject: [PATCH] Increase context and poll timeout duration |
| |
| These tests timeout only when running in arm64 Autotest VM. Increasing |
| the timeout helps create the dockerd test daemon without failing on |
| timeout and "context deadline exceeded" errors. |
| --- |
| integration/container/health_test.go | 2 +- |
| integration/container/restart_test.go | 6 +++--- |
| integration/container/update_test.go | 2 +- |
| integration/service/create_test.go | 6 +++--- |
| integration/service/inspect_test.go | 2 +- |
| integration/service/list_test.go | 3 ++- |
| testutil/daemon/daemon.go | 2 +- |
| 7 files changed, 12 insertions(+), 11 deletions(-) |
| |
| diff --git a/integration/container/health_test.go b/integration/container/health_test.go |
| index 9444bfa9ba..2543987d04 100644 |
| --- a/integration/container/health_test.go |
| +++ b/integration/container/health_test.go |
| @@ -82,7 +82,7 @@ while true; do sleep 1; done |
| |
| ctxPoll, cancel = context.WithTimeout(ctx, 30*time.Second) |
| defer cancel() |
| - poll.WaitOn(t, pollForHealthStatus(ctxPoll, apiClient, id, "unhealthy"), poll.WithDelay(100*time.Millisecond)) |
| + poll.WaitOn(t, pollForHealthStatus(ctxPoll, apiClient, id, "unhealthy"), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(180*time.Second)) |
| |
| err = apiClient.ContainerKill(ctx, id, "SIGUSR1") |
| assert.NilError(t, err) |
| diff --git a/integration/container/restart_test.go b/integration/container/restart_test.go |
| index a91b905c3b..0478cc64b9 100644 |
| --- a/integration/container/restart_test.go |
| +++ b/integration/container/restart_test.go |
| @@ -125,7 +125,7 @@ func TestDaemonRestartKillContainers(t *testing.T) { |
| expected = tc.xRunningLiveRestore |
| } |
| |
| - poll.WaitOn(t, testContainer.RunningStateFlagIs(ctx, apiClient, resp.ID, expected), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(30*time.Second)) |
| + poll.WaitOn(t, testContainer.RunningStateFlagIs(ctx, apiClient, resp.ID, expected), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(180*time.Second)) |
| |
| if tc.xHealthCheck { |
| // We have arranged to have the container's health probes fail until we tell it |
| @@ -133,10 +133,10 @@ func TestDaemonRestartKillContainers(t *testing.T) { |
| // the container's health state is Starting before we have to worry about racing |
| // the health monitor. |
| assert.Equal(t, testContainer.Inspect(ctx, t, apiClient, resp.ID).State.Health.Status, types.Starting) |
| - poll.WaitOn(t, pollForNewHealthCheck(ctx, apiClient, startTime, resp.ID), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(30*time.Second)) |
| + poll.WaitOn(t, pollForNewHealthCheck(ctx, apiClient, startTime, resp.ID), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(180*time.Second)) |
| |
| testContainer.ExecT(ctx, t, apiClient, resp.ID, []string{"rm", "/tmp/unhealthy"}).AssertSuccess(t) |
| - poll.WaitOn(t, pollForHealthStatus(ctx, apiClient, resp.ID, types.Healthy), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(30*time.Second)) |
| + poll.WaitOn(t, pollForHealthStatus(ctx, apiClient, resp.ID, types.Healthy), poll.WithDelay(100*time.Millisecond), poll.WithTimeout(180*time.Second)) |
| } |
| // TODO(cpuguy83): test pause states... this seems to be rather undefined currently |
| }) |
| diff --git a/integration/container/update_test.go b/integration/container/update_test.go |
| index 672def670b..0b72f96c21 100644 |
| --- a/integration/container/update_test.go |
| +++ b/integration/container/update_test.go |
| @@ -30,7 +30,7 @@ func TestUpdateRestartPolicy(t *testing.T) { |
| }) |
| assert.NilError(t, err) |
| |
| - timeout := 60 * time.Second |
| + timeout := 180 * time.Second |
| if testEnv.DaemonInfo.OSType == "windows" { |
| timeout = 180 * time.Second |
| } |
| diff --git a/integration/service/create_test.go b/integration/service/create_test.go |
| index a6c8ce0067..7b8ae85d01 100644 |
| --- a/integration/service/create_test.go |
| +++ b/integration/service/create_test.go |
| @@ -285,7 +285,7 @@ func TestCreateServiceConfigFileMode(t *testing.T) { |
| }), |
| ) |
| |
| - poll.WaitOn(t, swarm.RunningTasksCount(ctx, client, serviceID, instances)) |
| + poll.WaitOn(t, swarm.RunningTasksCount(ctx, client, serviceID, instances), poll.WithTimeout(180*time.Second)) |
| |
| body, err := client.ServiceLogs(ctx, serviceID, container.LogsOptions{ |
| Tail: "1", |
| @@ -350,7 +350,7 @@ func TestCreateServiceSysctls(t *testing.T) { |
| ) |
| |
| // wait for the service to converge to 1 running task as expected |
| - poll.WaitOn(t, swarm.RunningTasksCount(ctx, client, serviceID, instances)) |
| + poll.WaitOn(t, swarm.RunningTasksCount(ctx, client, serviceID, instances), poll.WithTimeout(180*time.Second)) |
| |
| // we're going to check 3 things: |
| // |
| @@ -422,7 +422,7 @@ func TestCreateServiceCapabilities(t *testing.T) { |
| ) |
| |
| // wait for the service to converge to 1 running task as expected |
| - poll.WaitOn(t, swarm.RunningTasksCount(ctx, client, serviceID, instances)) |
| + poll.WaitOn(t, swarm.RunningTasksCount(ctx, client, serviceID, instances), poll.WithTimeout(180*time.Second)) |
| |
| // we're going to check 3 things: |
| // |
| diff --git a/integration/service/inspect_test.go b/integration/service/inspect_test.go |
| index 74865b15f4..206bedcffc 100644 |
| --- a/integration/service/inspect_test.go |
| +++ b/integration/service/inspect_test.go |
| @@ -34,7 +34,7 @@ func TestInspect(t *testing.T) { |
| assert.NilError(t, err) |
| |
| id := resp.ID |
| - poll.WaitOn(t, swarm.RunningTasksCount(ctx, client, id, instances)) |
| + poll.WaitOn(t, swarm.RunningTasksCount(ctx, client, id, instances), poll.WithTimeout(180*time.Second)) |
| |
| service, _, err := client.ServiceInspectWithRaw(ctx, id, types.ServiceInspectOptions{}) |
| assert.NilError(t, err) |
| diff --git a/integration/service/list_test.go b/integration/service/list_test.go |
| index 05571bb3af..844f99ea80 100644 |
| --- a/integration/service/list_test.go |
| +++ b/integration/service/list_test.go |
| @@ -3,6 +3,7 @@ package service // import "github.com/docker/docker/integration/service" |
| import ( |
| "fmt" |
| "testing" |
| + "time" |
| |
| "github.com/docker/docker/api/types" |
| "github.com/docker/docker/api/types/filters" |
| @@ -75,7 +76,7 @@ func TestServiceListWithStatuses(t *testing.T) { |
| running, len(tasks), i+1, |
| ) |
| } |
| - }) |
| + }, poll.WithTimeout(180*time.Second)) |
| } |
| |
| // now, let's do the list operation with no status arg set. |
| diff --git a/testutil/daemon/daemon.go b/testutil/daemon/daemon.go |
| index 249bc03306..f4f9560c9b 100644 |
| --- a/testutil/daemon/daemon.go |
| +++ b/testutil/daemon/daemon.go |
| @@ -544,7 +544,7 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error { |
| req.URL.Host = clientConfig.addr |
| req.URL.Scheme = clientConfig.scheme |
| |
| - ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) |
| + ctx, cancel := context.WithTimeout(context.Background(), 300*time.Second) |
| defer cancel() |
| |
| // make sure daemon is ready to receive requests |
| |
| |