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>
66 lines
2 KiB
Go
66 lines
2 KiB
Go
package container // import "github.com/docker/docker/integration/container"
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/docker/docker/api/types"
|
|
"github.com/docker/docker/client"
|
|
"github.com/docker/docker/integration/internal/container"
|
|
"gotest.tools/assert"
|
|
is "gotest.tools/assert/cmp"
|
|
"gotest.tools/skip"
|
|
)
|
|
|
|
func TestCopyFromContainerPathDoesNotExist(t *testing.T) {
|
|
defer setupTest(t)()
|
|
skip.If(t, testEnv.OSType == "windows")
|
|
|
|
ctx := context.Background()
|
|
apiclient := testEnv.APIClient()
|
|
cid := container.Create(t, ctx, apiclient)
|
|
|
|
_, _, err := apiclient.CopyFromContainer(ctx, cid, "/dne")
|
|
assert.Check(t, client.IsErrNotFound(err))
|
|
expected := fmt.Sprintf("No such container:path: %s:%s", cid, "/dne")
|
|
assert.Check(t, is.ErrorContains(err, expected))
|
|
}
|
|
|
|
func TestCopyFromContainerPathIsNotDir(t *testing.T) {
|
|
defer setupTest(t)()
|
|
skip.If(t, testEnv.OSType == "windows")
|
|
|
|
ctx := context.Background()
|
|
apiclient := testEnv.APIClient()
|
|
cid := container.Create(t, ctx, apiclient)
|
|
|
|
_, _, err := apiclient.CopyFromContainer(ctx, cid, "/etc/passwd/")
|
|
assert.Assert(t, is.ErrorContains(err, "not a directory"))
|
|
}
|
|
|
|
func TestCopyToContainerPathDoesNotExist(t *testing.T) {
|
|
defer setupTest(t)()
|
|
skip.If(t, testEnv.OSType == "windows")
|
|
|
|
ctx := context.Background()
|
|
apiclient := testEnv.APIClient()
|
|
cid := container.Create(t, ctx, apiclient)
|
|
|
|
err := apiclient.CopyToContainer(ctx, cid, "/dne", nil, types.CopyToContainerOptions{})
|
|
assert.Check(t, client.IsErrNotFound(err))
|
|
expected := fmt.Sprintf("No such container:path: %s:%s", cid, "/dne")
|
|
assert.Check(t, is.ErrorContains(err, expected))
|
|
}
|
|
|
|
func TestCopyToContainerPathIsNotDir(t *testing.T) {
|
|
defer setupTest(t)()
|
|
skip.If(t, testEnv.OSType == "windows")
|
|
|
|
ctx := context.Background()
|
|
apiclient := testEnv.APIClient()
|
|
cid := container.Create(t, ctx, apiclient)
|
|
|
|
err := apiclient.CopyToContainer(ctx, cid, "/etc/passwd/", nil, types.CopyToContainerOptions{})
|
|
assert.Assert(t, is.ErrorContains(err, "not a directory"))
|
|
}
|