client/task_inspect_test: use containerd errdefs checks

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
Paweł Gronowski
2025-05-19 14:14:19 +02:00
committed by Sebastiaan van Stijn
parent 68a8a8f3c8
commit 6cd9eaf5ab

View File

@@ -11,8 +11,8 @@ import (
"strings"
"testing"
cerrdefs "github.com/containerd/errdefs"
"github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/errdefs"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)
@@ -23,7 +23,7 @@ func TestTaskInspectError(t *testing.T) {
}
_, _, err := client.TaskInspectWithRaw(context.Background(), "nothing")
assert.Check(t, is.ErrorType(err, errdefs.IsSystem))
assert.Check(t, is.ErrorType(err, cerrdefs.IsInternal))
}
func TestTaskInspectWithEmptyID(t *testing.T) {
@@ -33,11 +33,11 @@ func TestTaskInspectWithEmptyID(t *testing.T) {
}),
}
_, _, err := client.TaskInspectWithRaw(context.Background(), "")
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.TaskInspectWithRaw(context.Background(), " ")
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"))
}