Ver código fonte

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 8f800c941570ffcd087c920c37d3a368a5a19e6d,
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>
Sebastiaan van Stijn 1 ano atrás
pai
commit
a4ceb0e4ac
1 arquivos alterados com 3 adições e 9 exclusões
  1. 3 9
      integration/container/resize_test.go

+ 3 - 9
integration/container/resize_test.go

@@ -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))
 }