From 38f61539e5dcd1cbf32d6e4221d2b42df29385c5 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 1 Feb 2025 14:42:18 +0100 Subject: [PATCH] cli/command/network: remove uses of pkg/errors in tests While there may be reasons to keep pkg/errors in production code, we don't need them for these tests. Signed-off-by: Sebastiaan van Stijn --- cli/command/network/connect_test.go | 4 ++-- cli/command/network/create_test.go | 4 ++-- cli/command/network/disconnect_test.go | 4 ++-- cli/command/network/list_test.go | 4 ++-- cli/command/network/prune_test.go | 2 +- cli/command/network/remove_test.go | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/cli/command/network/connect_test.go b/cli/command/network/connect_test.go index f51ef869ed..a64ede90b8 100644 --- a/cli/command/network/connect_test.go +++ b/cli/command/network/connect_test.go @@ -2,12 +2,12 @@ package network import ( "context" + "errors" "io" "testing" "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/network" - "github.com/pkg/errors" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" ) @@ -24,7 +24,7 @@ func TestNetworkConnectErrors(t *testing.T) { { args: []string{"toto", "titi"}, networkConnectFunc: func(ctx context.Context, networkID, container string, config *network.EndpointSettings) error { - return errors.Errorf("error connecting network") + return errors.New("error connecting network") }, expectedError: "error connecting network", }, diff --git a/cli/command/network/create_test.go b/cli/command/network/create_test.go index 0cc682e2ed..97348c86d8 100644 --- a/cli/command/network/create_test.go +++ b/cli/command/network/create_test.go @@ -2,13 +2,13 @@ package network import ( "context" + "errors" "io" "strings" "testing" "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/network" - "github.com/pkg/errors" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" ) @@ -26,7 +26,7 @@ func TestNetworkCreateErrors(t *testing.T) { { args: []string{"toto"}, networkCreateFunc: func(ctx context.Context, name string, createBody network.CreateOptions) (network.CreateResponse, error) { - return network.CreateResponse{}, errors.Errorf("error creating network") + return network.CreateResponse{}, errors.New("error creating network") }, expectedError: "error creating network", }, diff --git a/cli/command/network/disconnect_test.go b/cli/command/network/disconnect_test.go index bb82452a6c..c9aeea4ec7 100644 --- a/cli/command/network/disconnect_test.go +++ b/cli/command/network/disconnect_test.go @@ -2,11 +2,11 @@ package network import ( "context" + "errors" "io" "testing" "github.com/docker/cli/internal/test" - "github.com/pkg/errors" "gotest.tools/v3/assert" ) @@ -22,7 +22,7 @@ func TestNetworkDisconnectErrors(t *testing.T) { { args: []string{"toto", "titi"}, networkDisconnectFunc: func(ctx context.Context, networkID, container string, force bool) error { - return errors.Errorf("error disconnecting network") + return errors.New("error disconnecting network") }, expectedError: "error disconnecting network", }, diff --git a/cli/command/network/list_test.go b/cli/command/network/list_test.go index cc08a00096..b3d253bf4d 100644 --- a/cli/command/network/list_test.go +++ b/cli/command/network/list_test.go @@ -2,6 +2,7 @@ package network import ( "context" + "errors" "io" "testing" @@ -10,7 +11,6 @@ import ( "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/network" "github.com/google/go-cmp/cmp" - "github.com/pkg/errors" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" "gotest.tools/v3/golden" @@ -23,7 +23,7 @@ func TestNetworkListErrors(t *testing.T) { }{ { networkListFunc: func(ctx context.Context, options network.ListOptions) ([]network.Summary, error) { - return []network.Summary{}, errors.Errorf("error creating network") + return []network.Summary{}, errors.New("error creating network") }, expectedError: "error creating network", }, diff --git a/cli/command/network/prune_test.go b/cli/command/network/prune_test.go index 16010d3c74..67a57e8c8a 100644 --- a/cli/command/network/prune_test.go +++ b/cli/command/network/prune_test.go @@ -2,13 +2,13 @@ package network import ( "context" + "errors" "io" "testing" "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/api/types/network" - "github.com/pkg/errors" ) func TestNetworkPrunePromptTermination(t *testing.T) { diff --git a/cli/command/network/remove_test.go b/cli/command/network/remove_test.go index 01052b0bf5..a1390d8b8d 100644 --- a/cli/command/network/remove_test.go +++ b/cli/command/network/remove_test.go @@ -2,13 +2,13 @@ package network import ( "context" + "errors" "io" "testing" "github.com/docker/cli/internal/test" "github.com/docker/docker/api/types/network" "github.com/docker/docker/errdefs" - "github.com/pkg/errors" "gotest.tools/v3/assert" is "gotest.tools/v3/assert/cmp" )