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 <github@gone.nl>
This commit is contained in:
parent
d6c26471d1
commit
38f61539e5
@ -2,12 +2,12 @@ package network
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
)
|
)
|
||||||
@ -24,7 +24,7 @@ func TestNetworkConnectErrors(t *testing.T) {
|
|||||||
{
|
{
|
||||||
args: []string{"toto", "titi"},
|
args: []string{"toto", "titi"},
|
||||||
networkConnectFunc: func(ctx context.Context, networkID, container string, config *network.EndpointSettings) error {
|
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",
|
expectedError: "error connecting network",
|
||||||
},
|
},
|
||||||
|
@ -2,13 +2,13 @@ package network
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
)
|
)
|
||||||
@ -26,7 +26,7 @@ func TestNetworkCreateErrors(t *testing.T) {
|
|||||||
{
|
{
|
||||||
args: []string{"toto"},
|
args: []string{"toto"},
|
||||||
networkCreateFunc: func(ctx context.Context, name string, createBody network.CreateOptions) (network.CreateResponse, error) {
|
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",
|
expectedError: "error creating network",
|
||||||
},
|
},
|
||||||
|
@ -2,11 +2,11 @@ package network
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ func TestNetworkDisconnectErrors(t *testing.T) {
|
|||||||
{
|
{
|
||||||
args: []string{"toto", "titi"},
|
args: []string{"toto", "titi"},
|
||||||
networkDisconnectFunc: func(ctx context.Context, networkID, container string, force bool) error {
|
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",
|
expectedError: "error disconnecting network",
|
||||||
},
|
},
|
||||||
|
@ -2,6 +2,7 @@ package network
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -10,7 +11,6 @@ import (
|
|||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/google/go-cmp/cmp"
|
"github.com/google/go-cmp/cmp"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
"gotest.tools/v3/golden"
|
"gotest.tools/v3/golden"
|
||||||
@ -23,7 +23,7 @@ func TestNetworkListErrors(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
networkListFunc: func(ctx context.Context, options network.ListOptions) ([]network.Summary, error) {
|
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",
|
expectedError: "error creating network",
|
||||||
},
|
},
|
||||||
|
@ -2,13 +2,13 @@ package network
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/docker/docker/api/types/filters"
|
"github.com/docker/docker/api/types/filters"
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/pkg/errors"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestNetworkPrunePromptTermination(t *testing.T) {
|
func TestNetworkPrunePromptTermination(t *testing.T) {
|
||||||
|
@ -2,13 +2,13 @@ package network
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/docker/cli/internal/test"
|
"github.com/docker/cli/internal/test"
|
||||||
"github.com/docker/docker/api/types/network"
|
"github.com/docker/docker/api/types/network"
|
||||||
"github.com/docker/docker/errdefs"
|
"github.com/docker/docker/errdefs"
|
||||||
"github.com/pkg/errors"
|
|
||||||
"gotest.tools/v3/assert"
|
"gotest.tools/v3/assert"
|
||||||
is "gotest.tools/v3/assert/cmp"
|
is "gotest.tools/v3/assert/cmp"
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user