integration/container: TestResize, TestResizeWithInvalidSize: rm poll.WaitOn

container.Run should be an synchronous operation; the container should
be running after the request was made (or produce an error). Simplify
these tests, and remove the redundant polling.

These were added as part of 8f800c9415,
but no such polls were in place before the refactor, and there's no
mention of these during review of the PR, so I assume these were just
added either as a "precaution", or a result of "copy/paste" from another
test.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-09-07 14:36:11 +02:00
parent ee7ca6822a
commit a4ceb0e4ac
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C

View file

@ -3,7 +3,6 @@ package container // import "github.com/docker/docker/integration/container"
import (
"net/http"
"testing"
"time"
"github.com/docker/docker/api/types"
"github.com/docker/docker/api/types/versions"
@ -12,7 +11,6 @@ import (
req "github.com/docker/docker/testutil/request"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
"gotest.tools/v3/poll"
"gotest.tools/v3/skip"
)
@ -21,9 +19,6 @@ func TestResize(t *testing.T) {
apiClient := testEnv.APIClient()
cID := container.Run(ctx, t, apiClient, container.WithTty(true))
poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
err := apiClient.ContainerResize(ctx, cID, types.ResizeOptions{
Height: 40,
Width: 40,
@ -38,10 +33,9 @@ func TestResizeWithInvalidSize(t *testing.T) {
cID := container.Run(ctx, t, apiClient)
poll.WaitOn(t, container.IsInState(ctx, apiClient, cID, "running"), poll.WithDelay(100*time.Millisecond))
endpoint := "/containers/" + cID + "/resize?h=foo&w=bar"
res, _, err := req.Post(ctx, endpoint)
// Manually creating a request here, as the APIClient would invalidate
// these values before they're sent.
res, _, err := req.Post(ctx, "/containers/"+cID+"/resize?h=foo&w=bar")
assert.NilError(t, err)
assert.Check(t, is.DeepEqual(http.StatusBadRequest, res.StatusCode))
}