Prepare tests for Windows containerd support
Signed-off-by: Olli Janatuinen <olli.janatuinen@gmail.com>
This commit is contained in:
parent
72fef53cec
commit
bffa730860
6 changed files with 19 additions and 11 deletions
|
@ -440,7 +440,7 @@ func (s *DockerSuite) TestEventsCopy(c *testing.T) {
|
|||
}
|
||||
|
||||
func (s *DockerSuite) TestEventsResize(c *testing.T) {
|
||||
out := runSleepingContainer(c, "-d")
|
||||
out := runSleepingContainer(c, "-d", "-t")
|
||||
cID := strings.TrimSpace(out)
|
||||
assert.NilError(c, waitRun(cID))
|
||||
|
||||
|
|
|
@ -35,14 +35,19 @@ func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
|
|||
|
||||
func TestCopyFromContainerPathIsNotDir(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
skip.If(t, testEnv.OSType == "windows")
|
||||
|
||||
ctx := context.Background()
|
||||
apiclient := testEnv.APIClient()
|
||||
cid := container.Create(ctx, t, apiclient)
|
||||
|
||||
_, _, err := apiclient.CopyFromContainer(ctx, cid, "/etc/passwd/")
|
||||
assert.Assert(t, is.ErrorContains(err, "not a directory"))
|
||||
path := "/etc/passwd/"
|
||||
expected := "not a directory"
|
||||
if testEnv.OSType == "windows" {
|
||||
path = "c:/windows/system32/drivers/etc/hosts/"
|
||||
expected = "The filename, directory name, or volume label syntax is incorrect."
|
||||
}
|
||||
_, _, err := apiclient.CopyFromContainer(ctx, cid, path)
|
||||
assert.Assert(t, is.ErrorContains(err, expected))
|
||||
}
|
||||
|
||||
func TestCopyToContainerPathDoesNotExist(t *testing.T) {
|
||||
|
@ -60,13 +65,16 @@ func TestCopyToContainerPathDoesNotExist(t *testing.T) {
|
|||
|
||||
func TestCopyToContainerPathIsNotDir(t *testing.T) {
|
||||
defer setupTest(t)()
|
||||
skip.If(t, testEnv.OSType == "windows")
|
||||
|
||||
ctx := context.Background()
|
||||
apiclient := testEnv.APIClient()
|
||||
cid := container.Create(ctx, t, apiclient)
|
||||
|
||||
err := apiclient.CopyToContainer(ctx, cid, "/etc/passwd/", nil, types.CopyToContainerOptions{})
|
||||
path := "/etc/passwd/"
|
||||
if testEnv.OSType == "windows" {
|
||||
path = "c:/windows/system32/drivers/etc/hosts/"
|
||||
}
|
||||
err := apiclient.CopyToContainer(ctx, cid, path, nil, types.CopyToContainerOptions{})
|
||||
assert.Assert(t, is.ErrorContains(err, "not a directory"))
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import (
|
|||
"testing"
|
||||
"time"
|
||||
|
||||
containerderrdefs "github.com/containerd/containerd/errdefs"
|
||||
"github.com/docker/docker/api/types"
|
||||
"github.com/docker/docker/api/types/events"
|
||||
"github.com/docker/docker/api/types/filters"
|
||||
|
@ -62,7 +63,7 @@ func TestPauseFailsOnWindowsServerContainers(t *testing.T) {
|
|||
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
|
||||
|
||||
err := client.ContainerPause(ctx, cID)
|
||||
assert.Check(t, is.ErrorContains(err, "cannot pause Windows Server Containers"))
|
||||
assert.Check(t, is.ErrorContains(err, containerderrdefs.ErrNotImplemented.Error()))
|
||||
}
|
||||
|
||||
func TestPauseStopPausedContainer(t *testing.T) {
|
||||
|
|
|
@ -123,7 +123,6 @@ func TestRenameInvalidName(t *testing.T) {
|
|||
// This test is to make sure once the container has been renamed,
|
||||
// the service discovery for the (re)named container works.
|
||||
func TestRenameAnonymousContainer(t *testing.T) {
|
||||
skip.If(t, testEnv.OSType == "windows", "FIXME")
|
||||
defer setupTest(t)()
|
||||
ctx := context.Background()
|
||||
client := testEnv.APIClient()
|
||||
|
|
|
@ -21,7 +21,7 @@ func TestResize(t *testing.T) {
|
|||
client := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
||||
cID := container.Run(ctx, t, client)
|
||||
cID := container.Run(ctx, t, client, container.WithTty(true))
|
||||
|
||||
poll.WaitOn(t, container.IsInState(ctx, client, cID, "running"), poll.WithDelay(100*time.Millisecond))
|
||||
|
||||
|
@ -34,7 +34,6 @@ func TestResize(t *testing.T) {
|
|||
|
||||
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 := testEnv.APIClient()
|
||||
ctx := context.Background()
|
||||
|
|
|
@ -22,6 +22,7 @@ import (
|
|||
opengcs "github.com/Microsoft/opengcs/client"
|
||||
"github.com/containerd/containerd"
|
||||
"github.com/containerd/containerd/cio"
|
||||
containerderrdefs "github.com/containerd/containerd/errdefs"
|
||||
|
||||
"github.com/docker/docker/errdefs"
|
||||
"github.com/docker/docker/libcontainerd/queue"
|
||||
|
@ -985,7 +986,7 @@ func (c *client) Pause(_ context.Context, containerID string) error {
|
|||
}
|
||||
|
||||
if ctr.ociSpec.Windows.HyperV == nil {
|
||||
return errors.New("cannot pause Windows Server Containers")
|
||||
return containerderrdefs.ErrNotImplemented
|
||||
}
|
||||
|
||||
ctr.Lock()
|
||||
|
|
Loading…
Add table
Reference in a new issue