mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
client/container: use containerd errdefs checks
Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
committed by
Sebastiaan van Stijn
parent
eafa2266f6
commit
c75ca8ef10
@@ -10,8 +10,8 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
cerrdefs "github.com/containerd/errdefs"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
"github.com/docker/docker/errdefs"
|
||||
"gotest.tools/v3/assert"
|
||||
is "gotest.tools/v3/assert/cmp"
|
||||
)
|
||||
@@ -22,14 +22,14 @@ func TestContainerExecCreateError(t *testing.T) {
|
||||
}
|
||||
|
||||
_, err := client.ContainerExecCreate(context.Background(), "container_id", container.ExecOptions{})
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
|
||||
_, err = client.ContainerExecCreate(context.Background(), "", container.ExecOptions{})
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
|
||||
_, err = client.ContainerExecCreate(context.Background(), " ", container.ExecOptions{})
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsInvalidParameter))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInvalidArgument))
|
||||
assert.Check(t, is.ErrorContains(err, "value is empty"))
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ func TestContainerExecStartError(t *testing.T) {
|
||||
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
|
||||
}
|
||||
err := client.ContainerExecStart(context.Background(), "nothing", container.ExecStartOptions{})
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
}
|
||||
|
||||
func TestContainerExecStart(t *testing.T) {
|
||||
@@ -131,7 +131,7 @@ func TestContainerExecInspectError(t *testing.T) {
|
||||
client: newMockClient(errorMock(http.StatusInternalServerError, "Server error")),
|
||||
}
|
||||
_, err := client.ContainerExecInspect(context.Background(), "nothing")
|
||||
assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
|
||||
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
|
||||
}
|
||||
|
||||
func TestContainerExecInspect(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user