DockerCLI/cli/command/volume/list_test.go

237 lines
6.7 KiB
Go
Raw Normal View History

package volume
import (
"io"
"testing"
"github.com/docker/cli/cli/config/configfile"
"github.com/docker/cli/internal/test"
cli/command: remove dot-imports and unhandled errors Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 08:51:01 -04:00
"github.com/docker/cli/internal/test/builders"
"github.com/docker/docker/api/types/filters"
"github.com/docker/docker/api/types/volume"
"github.com/pkg/errors"
"gotest.tools/v3/assert"
"gotest.tools/v3/golden"
)
func TestVolumeListErrors(t *testing.T) {
testCases := []struct {
args []string
flags map[string]string
volumeListFunc func(filter filters.Args) (volume.ListResponse, error)
expectedError string
}{
{
args: []string{"foo"},
expectedError: "accepts no argument",
},
{
volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) {
return volume.ListResponse{}, errors.Errorf("error listing volumes")
},
expectedError: "error listing volumes",
},
}
for _, tc := range testCases {
cmd := newListCommand(
test.NewFakeCli(&fakeClient{
volumeListFunc: tc.volumeListFunc,
}),
)
cmd.SetArgs(tc.args)
for key, value := range tc.flags {
cli/command: remove dot-imports and unhandled errors Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 08:51:01 -04:00
assert.Check(t, cmd.Flags().Set(key, value))
}
cmd.SetOut(io.Discard)
cmd.SetErr(io.Discard)
assert.ErrorContains(t, cmd.Execute(), tc.expectedError)
}
}
func TestVolumeListWithoutFormat(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{
volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) {
return volume.ListResponse{
Volumes: []*volume.Volume{
cli/command: remove dot-imports and unhandled errors Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 08:51:01 -04:00
builders.Volume(),
builders.Volume(builders.VolumeName("foo"), builders.VolumeDriver("bar")),
builders.Volume(builders.VolumeName("baz"), builders.VolumeLabels(map[string]string{
"foo": "bar",
})),
},
}, nil
},
})
cmd := newListCommand(cli)
assert.NilError(t, cmd.Execute())
golden.Assert(t, cli.OutBuffer().String(), "volume-list-without-format.golden")
}
func TestVolumeListWithConfigFormat(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{
volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) {
return volume.ListResponse{
Volumes: []*volume.Volume{
cli/command: remove dot-imports and unhandled errors Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 08:51:01 -04:00
builders.Volume(),
builders.Volume(builders.VolumeName("foo"), builders.VolumeDriver("bar")),
builders.Volume(builders.VolumeName("baz"), builders.VolumeLabels(map[string]string{
"foo": "bar",
})),
},
}, nil
},
})
cli.SetConfigFile(&configfile.ConfigFile{
VolumesFormat: "{{ .Name }} {{ .Driver }} {{ .Labels }}",
})
cmd := newListCommand(cli)
assert.NilError(t, cmd.Execute())
golden.Assert(t, cli.OutBuffer().String(), "volume-list-with-config-format.golden")
}
func TestVolumeListWithFormat(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{
volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) {
return volume.ListResponse{
Volumes: []*volume.Volume{
cli/command: remove dot-imports and unhandled errors Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 08:51:01 -04:00
builders.Volume(),
builders.Volume(builders.VolumeName("foo"), builders.VolumeDriver("bar")),
builders.Volume(builders.VolumeName("baz"), builders.VolumeLabels(map[string]string{
"foo": "bar",
})),
},
}, nil
},
})
cmd := newListCommand(cli)
cli/command: remove dot-imports and unhandled errors Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 08:51:01 -04:00
assert.Check(t, cmd.Flags().Set("format", "{{ .Name }} {{ .Driver }} {{ .Labels }}"))
assert.NilError(t, cmd.Execute())
golden.Assert(t, cli.OutBuffer().String(), "volume-list-with-format.golden")
}
func TestVolumeListSortOrder(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{
volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) {
return volume.ListResponse{
Volumes: []*volume.Volume{
cli/command: remove dot-imports and unhandled errors Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 08:51:01 -04:00
builders.Volume(builders.VolumeName("volume-2-foo")),
builders.Volume(builders.VolumeName("volume-10-foo")),
builders.Volume(builders.VolumeName("volume-1-foo")),
},
}, nil
},
})
cmd := newListCommand(cli)
cli/command: remove dot-imports and unhandled errors Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 08:51:01 -04:00
assert.Check(t, cmd.Flags().Set("format", "{{ .Name }}"))
assert.NilError(t, cmd.Execute())
golden.Assert(t, cli.OutBuffer().String(), "volume-list-sort.golden")
}
func TestClusterVolumeList(t *testing.T) {
cli := test.NewFakeCli(&fakeClient{
volumeListFunc: func(filter filters.Args) (volume.ListResponse, error) {
return volume.ListResponse{
Volumes: []*volume.Volume{
{
Name: "volume1",
Scope: "global",
Driver: "driver1",
ClusterVolume: &volume.ClusterVolume{
Spec: volume.ClusterVolumeSpec{
Group: "group1",
AccessMode: &volume.AccessMode{
Scope: volume.ScopeSingleNode,
Sharing: volume.SharingOneWriter,
MountVolume: &volume.TypeMount{},
},
Availability: volume.AvailabilityActive,
},
},
},
{
Name: "volume2",
Scope: "global",
Driver: "driver1",
ClusterVolume: &volume.ClusterVolume{
Spec: volume.ClusterVolumeSpec{
Group: "group1",
AccessMode: &volume.AccessMode{
Scope: volume.ScopeSingleNode,
Sharing: volume.SharingOneWriter,
MountVolume: &volume.TypeMount{},
},
Availability: volume.AvailabilityPause,
},
Info: &volume.Info{
CapacityBytes: 100000000,
VolumeID: "driver1vol2",
},
},
},
{
Name: "volume3",
Scope: "global",
Driver: "driver2",
ClusterVolume: &volume.ClusterVolume{
Spec: volume.ClusterVolumeSpec{
Group: "group2",
AccessMode: &volume.AccessMode{
Scope: volume.ScopeMultiNode,
Sharing: volume.SharingAll,
MountVolume: &volume.TypeMount{},
},
Availability: volume.AvailabilityActive,
},
PublishStatus: []*volume.PublishStatus{
{
NodeID: "nodeid1",
State: volume.StatePublished,
},
},
Info: &volume.Info{
CapacityBytes: 100000000,
VolumeID: "driver1vol3",
},
},
},
{
Name: "volume4",
Scope: "global",
Driver: "driver2",
ClusterVolume: &volume.ClusterVolume{
Spec: volume.ClusterVolumeSpec{
Group: "group2",
AccessMode: &volume.AccessMode{
Scope: volume.ScopeMultiNode,
Sharing: volume.SharingAll,
MountVolume: &volume.TypeMount{},
},
Availability: volume.AvailabilityActive,
},
PublishStatus: []*volume.PublishStatus{
{
NodeID: "nodeid1",
State: volume.StatePublished,
}, {
NodeID: "nodeid2",
State: volume.StatePublished,
},
},
Info: &volume.Info{
CapacityBytes: 100000000,
VolumeID: "driver1vol4",
},
},
},
cli/command: remove dot-imports and unhandled errors Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 08:51:01 -04:00
builders.Volume(builders.VolumeName("volume-local-1")),
},
}, nil
},
})
cmd := newListCommand(cli)
cli/command: remove dot-imports and unhandled errors Please the linters in preparation of updating golangci-lint; - remove dot-imports - add some checks for unhandled errors - replace some fixed-value variables for consts cli/command/image/build/context.go:238:17: G107: Potential HTTP request made with variable url (gosec) if resp, err = http.Get(url); err != nil { ^ cli/command/idresolver/idresolver_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/registry_test.go:7:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/cli/command" // Prevents a circular import with "github.com/docker/cli/internal/test" ^ cli/command/task/print_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/update_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/unlock_key_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/swarm/join_token_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/promote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/demote_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/node/ps_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/update_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/node/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package functions ^ cli/command/secret/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/secret/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/inspect_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/volume/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/inspect_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/config/ls_test.go:11:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/network/list_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/container/list_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/service/list_test.go:12:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" ^ cli/command/service/client_test.go:6:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/list_test.go:8:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/services_test.go:9:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ cli/command/stack/ps_test.go:10:2: dot-imports: should not use dot imports (revive) . "github.com/docker/cli/internal/test/builders" // Import builders to get the builder function as package function ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2023-10-23 08:51:01 -04:00
assert.Check(t, cmd.Flags().Set("cluster", "true"))
assert.NilError(t, cmd.Execute())
golden.Assert(t, cli.OutBuffer().String(), "volume-cluster-volume-list.golden")
}