浏览代码

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 年之前
父节点
当前提交
a4ceb0e4ac
共有 1 个文件被更改,包括 3 次插入9 次删除
  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 (
 import (
 	"net/http"
 	"net/http"
 	"testing"
 	"testing"
-	"time"
 
 
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types"
 	"github.com/docker/docker/api/types/versions"
 	"github.com/docker/docker/api/types/versions"
@@ -12,7 +11,6 @@ import (
 	req "github.com/docker/docker/testutil/request"
 	req "github.com/docker/docker/testutil/request"
 	"gotest.tools/v3/assert"
 	"gotest.tools/v3/assert"
 	is "gotest.tools/v3/assert/cmp"
 	is "gotest.tools/v3/assert/cmp"
-	"gotest.tools/v3/poll"
 	"gotest.tools/v3/skip"
 	"gotest.tools/v3/skip"
 )
 )
 
 
@@ -21,9 +19,6 @@ func TestResize(t *testing.T) {
 	apiClient := testEnv.APIClient()
 	apiClient := testEnv.APIClient()
 
 
 	cID := container.Run(ctx, t, apiClient, container.WithTty(true))
 	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{
 	err := apiClient.ContainerResize(ctx, cID, types.ResizeOptions{
 		Height: 40,
 		Height: 40,
 		Width:  40,
 		Width:  40,
@@ -38,10 +33,9 @@ func TestResizeWithInvalidSize(t *testing.T) {
 
 
 	cID := container.Run(ctx, t, apiClient)
 	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.NilError(t, err)
 	assert.Check(t, is.DeepEqual(http.StatusBadRequest, res.StatusCode))
 	assert.Check(t, is.DeepEqual(http.StatusBadRequest, res.StatusCode))
 }
 }