mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
d3cc071bb9
- Add windows CI entrypoint script. Signed-off-by: John Howard <jhoward@microsoft.com> Signed-off-by: Vincent Demeester <vincent@sbr.pm> Signed-off-by: Daniel Nephin <dnephin@docker.com> Signed-off-by: Vincent Demeester <vincent@sbr.pm>
68 lines
1.9 KiB
Go
68 lines
1.9 KiB
Go
package container // import "github.com/docker/docker/integration/container"
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/api/types/versions"
|
|
"github.com/docker/docker/integration/internal/container"
|
|
"github.com/docker/docker/internal/test/request"
|
|
req "github.com/docker/docker/internal/test/request"
|
|
"gotest.tools/assert"
|
|
is "gotest.tools/assert/cmp"
|
|
"gotest.tools/poll"
|
|
"gotest.tools/skip"
|
|
)
|
|
|
|
func TestResize(t *testing.T) {
|
|
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
|
defer setupTest(t)()
|
|
client := request.NewAPIClient(t)
|
|
ctx := context.Background()
|
|
|
|
cID := container.Run(t, ctx, client)
|
|
|
|
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
|
|
|
|
err := client.ContainerResize(ctx, cID, types.ResizeOptions{
|
|
Height: 40,
|
|
Width: 40,
|
|
})
|
|
assert.NilError(t, err)
|
|
}
|
|
|
|
func TestResizeWithInvalidSize(t *testing.T) {
|
|
skip.If(t, versions.LessThan(testEnv.DaemonAPIVersion(), "1.32"), "broken in earlier versions")
|
|
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
|
defer setupTest(t)()
|
|
client := request.NewAPIClient(t)
|
|
ctx := context.Background()
|
|
|
|
cID := container.Run(t, ctx, client)
|
|
|
|
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
|
|
|
|
endpoint := "/containers/" + cID + "/resize?h=foo&w=bar"
|
|
res, _, err := req.Post(endpoint)
|
|
assert.NilError(t, err)
|
|
assert.Check(t, is.DeepEqual(http.StatusBadRequest, res.StatusCode))
|
|
}
|
|
|
|
func TestResizeWhenContainerNotStarted(t *testing.T) {
|
|
defer setupTest(t)()
|
|
client := request.NewAPIClient(t)
|
|
ctx := context.Background()
|
|
|
|
cID := container.Run(t, ctx, client, container.WithCmd("echo"))
|
|
|
|
poll.WaitOn(t, container.IsInState(ctx, client, cID, "exited"), poll.WithDelay(100*time.Millisecond))
|
|
|
|
err := client.ContainerResize(ctx, cID, types.ResizeOptions{
|
|
Height: 40,
|
|
Width: 40,
|
|
})
|
|
assert.Check(t, is.ErrorContains(err, "is not running"))
|
|
}
|