diff options
author | Sebastiaan van Stijn <github@gone.nl> | 2023-05-10 13:17:40 +0200 |
---|---|---|
committer | Sebastiaan van Stijn <github@gone.nl> | 2023-05-10 22:13:38 +0200 |
commit | 66ff1e063eac6626658bafaa034a2ef9af9ad290 (patch) | |
tree | 5227ebde88a0dda06da4a2d5d1f66bd2612d274a /client/task_inspect_test.go | |
parent | 685b3d820a7f10d1d0b6e90a19f1ba0cf5c2caa2 (diff) | |
download | docker-66ff1e063eac6626658bafaa034a2ef9af9ad290.tar.gz |
client: update error-assertions in tests
- use is.ErrorType
- replace uses of client.IsErrNotFound for errdefs.IsNotFound, as
the client no longer returns the old error-type.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'client/task_inspect_test.go')
-rw-r--r-- | client/task_inspect_test.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/client/task_inspect_test.go b/client/task_inspect_test.go index f8ed67cf19..01e5deca64 100644 --- a/client/task_inspect_test.go +++ b/client/task_inspect_test.go @@ -13,6 +13,8 @@ import ( "github.com/docker/docker/api/types/swarm" "github.com/docker/docker/errdefs" "github.com/pkg/errors" + "gotest.tools/v3/assert" + is "gotest.tools/v3/assert/cmp" ) func TestTaskInspectError(t *testing.T) { @@ -21,9 +23,7 @@ func TestTaskInspectError(t *testing.T) { } _, _, err := client.TaskInspectWithRaw(context.Background(), "nothing") - if !errdefs.IsSystem(err) { - t.Fatalf("expected a Server Error, got %[1]T: %[1]v", err) - } + assert.Check(t, is.ErrorType(err, errdefs.IsSystem)) } func TestTaskInspectWithEmptyID(t *testing.T) { @@ -33,9 +33,7 @@ func TestTaskInspectWithEmptyID(t *testing.T) { }), } _, _, err := client.TaskInspectWithRaw(context.Background(), "") - if !IsErrNotFound(err) { - t.Fatalf("Expected NotFoundError, got %v", err) - } + assert.Check(t, is.ErrorType(err, errdefs.IsNotFound)) } func TestTaskInspect(t *testing.T) { |