Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integration-cli/docker_cli_events_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
18 changes: 13 additions & 5 deletions integration/container/copy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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"))
}

Expand Down
3 changes: 2 additions & 1 deletion integration/container/pause_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

w.r.t. https://github.com/moby/moby/pull/42164/files#r602423617

The daemon may be converting it from the containerd error type;

case containerderrors.IsNotImplemented(err):
return http.StatusNotImplemented

And on the client side, will handle it as an errdefs.InotImplemented();

moby/errdefs/is.go

Lines 79 to 83 in 81dbed4

// IsNotImplemented returns if the passed in error is an ErrNotImplemented
func IsNotImplemented(err error) bool {
_, ok := getImplementer(err).(ErrNotImplemented)
return ok
}

Oh, actually, it may not be converted; looking at

moby/daemon/pause.go

Lines 41 to 43 in 7b9275c

if err := daemon.containerd.Pause(context.Background(), container.ID); err != nil {
return fmt.Errorf("Cannot pause container %s: %s", container.ID, err)
}

It just trumps the error-type, and converts it into a generic error (likely will return a 500 error at the API level)

}

func TestPauseStopPausedContainer(t *testing.T) {
Expand Down
1 change: 0 additions & 1 deletion integration/container/rename_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
3 changes: 1 addition & 2 deletions integration/container/resize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand All @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion libcontainerd/local/local_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down