2016-12-25 16:23:35 -05:00
|
|
|
package test
|
|
|
|
|
|
|
|
import (
|
2017-07-05 14:19:52 -04:00
|
|
|
"bytes"
|
linting: fmt.Errorf can be replaced with errors.New (perfsprint)
internal/test/cli.go:175:14: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("no notary client available unless defined")
^
cli/command/cli.go:318:29: fmt.Errorf can be replaced with errors.New (perfsprint)
return docker.Endpoint{}, fmt.Errorf("no context store initialized")
^
cli/command/container/attach.go:161:11: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf(result.Error.Message)
^
cli/command/container/opts.go:577:16: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("--health-start-period cannot be negative")
^
cli/command/container/opts.go:580:16: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("--health-start-interval cannot be negative")
^
cli/command/container/stats.go:221:11: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("filtering is not supported when specifying a list of containers")
^
cli/command/container/attach_test.go:82:17: fmt.Errorf can be replaced with errors.New (perfsprint)
expectedErr = fmt.Errorf("unexpected error")
^
cli/command/container/create_test.go:234:40: fmt.Errorf can be replaced with errors.New (perfsprint)
return container.CreateResponse{}, fmt.Errorf("shouldn't try to pull image")
^
cli/command/container/list_test.go:150:17: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("error listing containers")
^
cli/command/container/rm_test.go:40:31: fmt.Errorf can be replaced with errors.New (perfsprint)
return errdefs.NotFound(fmt.Errorf("Error: no such container: " + container))
^
cli/command/container/run_test.go:138:40: fmt.Errorf can be replaced with errors.New (perfsprint)
return container.CreateResponse{}, fmt.Errorf("shouldn't try to pull image")
^
cli/command/image/pull_test.go:115:49: fmt.Errorf can be replaced with errors.New (perfsprint)
return io.NopCloser(strings.NewReader("")), fmt.Errorf("shouldn't try to pull image")
^
cli/command/network/connect.go:88:16: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("invalid key/value pair format in driver options")
^
cli/command/plugin/create_test.go:96:11: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("Error creating plugin")
^
cli/command/plugin/disable_test.go:32:12: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("Error disabling plugin")
^
cli/command/plugin/enable_test.go:32:12: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("failed to enable plugin")
^
cli/command/plugin/inspect_test.go:55:22: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, nil, fmt.Errorf("error inspecting plugin")
^
cli/command/plugin/install_test.go:43:17: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("Error installing plugin")
^
cli/command/plugin/install_test.go:51:17: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("(image) when fetching")
^
cli/command/plugin/install_test.go:95:17: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("should not try to install plugin")
^
cli/command/plugin/list_test.go:35:41: fmt.Errorf can be replaced with errors.New (perfsprint)
return types.PluginsListResponse{}, fmt.Errorf("error listing plugins")
^
cli/command/plugin/remove_test.go:27:12: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("Error removing plugin")
^
cli/command/registry/login_test.go:36:46: fmt.Errorf can be replaced with errors.New (perfsprint)
return registrytypes.AuthenticateOKBody{}, fmt.Errorf("Invalid Username or Password")
^
cli/command/registry/login_test.go:44:46: fmt.Errorf can be replaced with errors.New (perfsprint)
return registrytypes.AuthenticateOKBody{}, fmt.Errorf(errUnknownUser)
^
cli/command/system/info.go:190:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("errors pretty printing info")
^
cli/command/system/prune.go:77:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf(`ERROR: The "until" filter is not supported with "--volumes"`)
^
cli/command/system/version_test.go:19:28: fmt.Errorf can be replaced with errors.New (perfsprint)
return types.Version{}, fmt.Errorf("no server")
^
cli/command/trust/key_load.go:112:22: fmt.Errorf can be replaced with errors.New (perfsprint)
return []byte{}, fmt.Errorf("could not decrypt key")
^
cli/command/trust/revoke.go:44:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("cannot use a digest reference for IMAGE:TAG")
^
cli/command/trust/revoke.go:105:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("no signed tags to remove")
^
cli/command/trust/signer_add.go:56:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("releases is a reserved keyword, please use a different signer name")
^
cli/command/trust/signer_add.go:60:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("path to a public key must be provided using the `--key` flag")
^
opts/config.go:71:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("source is required")
^
opts/mount.go:168:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("type is required")
^
opts/mount.go:172:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("target is required")
^
opts/network.go:90:11: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("network name/id is not specified")
^
opts/network.go:129:18: fmt.Errorf can be replaced with errors.New (perfsprint)
return "", "", fmt.Errorf("invalid key value pair format in driver options")
^
opts/opts.go:404:13: fmt.Errorf can be replaced with errors.New (perfsprint)
return 0, fmt.Errorf("value is too precise")
^
opts/opts.go:412:18: fmt.Errorf can be replaced with errors.New (perfsprint)
return "", "", fmt.Errorf("empty string specified for links")
^
opts/parse.go:84:37: fmt.Errorf can be replaced with errors.New (perfsprint)
return container.RestartPolicy{}, fmt.Errorf("invalid restart policy format: no policy provided before colon")
^
opts/parse.go:89:38: fmt.Errorf can be replaced with errors.New (perfsprint)
return container.RestartPolicy{}, fmt.Errorf("invalid restart policy format: maximum retry count must be an integer")
^
opts/port.go:105:13: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("hostip is not supported")
^
opts/secret.go:70:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("source is required")
^
opts/env_test.go:57:11: fmt.Errorf can be replaced with errors.New (perfsprint)
err: fmt.Errorf("invalid environment variable: =a"),
^
opts/env_test.go:93:11: fmt.Errorf can be replaced with errors.New (perfsprint)
err: fmt.Errorf("invalid environment variable: ="),
^
cli-plugins/manager/error_test.go:16:11: fmt.Errorf can be replaced with errors.New (perfsprint)
inner := fmt.Errorf("testing")
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-10 14:47:07 -04:00
|
|
|
"errors"
|
2016-12-25 16:23:35 -05:00
|
|
|
"io"
|
2017-02-27 12:39:35 -05:00
|
|
|
"strings"
|
2016-12-25 16:23:35 -05:00
|
|
|
|
2017-04-17 18:07:56 -04:00
|
|
|
"github.com/docker/cli/cli/command"
|
|
|
|
"github.com/docker/cli/cli/config/configfile"
|
2018-11-09 09:10:41 -05:00
|
|
|
"github.com/docker/cli/cli/context/docker"
|
|
|
|
"github.com/docker/cli/cli/context/store"
|
2017-06-15 14:41:54 -04:00
|
|
|
manifeststore "github.com/docker/cli/cli/manifest/store"
|
|
|
|
registryclient "github.com/docker/cli/cli/registry/client"
|
2019-01-28 08:30:31 -05:00
|
|
|
"github.com/docker/cli/cli/streams"
|
2017-09-26 18:15:04 -04:00
|
|
|
"github.com/docker/cli/cli/trust"
|
2017-05-08 12:33:45 -04:00
|
|
|
"github.com/docker/docker/client"
|
2017-10-30 12:21:41 -04:00
|
|
|
notaryclient "github.com/theupdateframework/notary/client"
|
2016-12-25 16:23:35 -05:00
|
|
|
)
|
|
|
|
|
2018-03-08 08:35:17 -05:00
|
|
|
// NotaryClientFuncType defines a function that returns a fake notary client
|
|
|
|
type NotaryClientFuncType func(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)
|
2017-09-14 16:16:54 -04:00
|
|
|
|
2016-12-25 16:23:35 -05:00
|
|
|
// FakeCli emulates the default DockerCli
|
|
|
|
type FakeCli struct {
|
|
|
|
command.DockerCli
|
2019-11-28 10:54:51 -05:00
|
|
|
client client.APIClient
|
|
|
|
configfile *configfile.ConfigFile
|
|
|
|
out *streams.Out
|
|
|
|
outBuffer *bytes.Buffer
|
2024-06-11 10:49:25 -04:00
|
|
|
err *streams.Out
|
|
|
|
errBuffer *bytes.Buffer
|
2019-11-28 10:54:51 -05:00
|
|
|
in *streams.In
|
|
|
|
server command.ServerInfo
|
|
|
|
notaryClientFunc NotaryClientFuncType
|
|
|
|
manifestStore manifeststore.Store
|
|
|
|
registryClient registryclient.RegistryClient
|
|
|
|
contentTrust bool
|
|
|
|
contextStore store.Store
|
|
|
|
currentContext string
|
|
|
|
dockerEndpoint docker.Endpoint
|
2016-12-25 16:23:35 -05:00
|
|
|
}
|
|
|
|
|
2017-07-05 14:19:52 -04:00
|
|
|
// NewFakeCli returns a fake for the command.Cli interface
|
2023-11-20 11:38:50 -05:00
|
|
|
func NewFakeCli(apiClient client.APIClient, opts ...func(*FakeCli)) *FakeCli {
|
2017-07-05 14:19:52 -04:00
|
|
|
outBuffer := new(bytes.Buffer)
|
|
|
|
errBuffer := new(bytes.Buffer)
|
2018-03-08 08:35:17 -05:00
|
|
|
c := &FakeCli{
|
2023-11-20 11:38:50 -05:00
|
|
|
client: apiClient,
|
2019-01-28 08:30:31 -05:00
|
|
|
out: streams.NewOut(outBuffer),
|
2018-03-05 19:59:53 -05:00
|
|
|
outBuffer: outBuffer,
|
2024-06-11 10:49:25 -04:00
|
|
|
err: streams.NewOut(errBuffer),
|
|
|
|
errBuffer: errBuffer,
|
2022-02-25 09:32:54 -05:00
|
|
|
in: streams.NewIn(io.NopCloser(strings.NewReader(""))),
|
2018-03-05 19:59:53 -05:00
|
|
|
// Use an empty string for filename so that tests don't create configfiles
|
|
|
|
// Set cli.ConfigFile().Filename to a tempfile to support Save.
|
2022-02-22 07:46:35 -05:00
|
|
|
configfile: configfile.New(""),
|
|
|
|
currentContext: command.DefaultContextName,
|
2016-12-25 16:23:35 -05:00
|
|
|
}
|
2018-03-08 08:35:17 -05:00
|
|
|
for _, opt := range opts {
|
|
|
|
opt(c)
|
|
|
|
}
|
|
|
|
return c
|
2016-12-25 16:23:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetIn sets the input of the cli to the specified ReadCloser
|
2019-01-28 08:30:31 -05:00
|
|
|
func (c *FakeCli) SetIn(in *streams.In) {
|
2016-12-25 16:23:35 -05:00
|
|
|
c.in = in
|
|
|
|
}
|
|
|
|
|
2017-02-22 15:43:13 -05:00
|
|
|
// SetErr sets the stderr stream for the cli to the specified io.Writer
|
2024-06-11 10:49:25 -04:00
|
|
|
func (c *FakeCli) SetErr(err *streams.Out) {
|
2017-02-27 12:39:35 -05:00
|
|
|
c.err = err
|
|
|
|
}
|
|
|
|
|
2018-11-09 09:10:41 -05:00
|
|
|
// SetOut sets the stdout stream for the cli to the specified io.Writer
|
2019-01-28 08:30:31 -05:00
|
|
|
func (c *FakeCli) SetOut(out *streams.Out) {
|
2018-11-09 09:10:41 -05:00
|
|
|
c.out = out
|
|
|
|
}
|
|
|
|
|
2017-07-05 14:34:16 -04:00
|
|
|
// SetConfigFile sets the "fake" config file
|
2023-11-20 11:38:50 -05:00
|
|
|
func (c *FakeCli) SetConfigFile(configFile *configfile.ConfigFile) {
|
|
|
|
c.configfile = configFile
|
2017-02-27 12:39:35 -05:00
|
|
|
}
|
|
|
|
|
2018-11-09 09:10:41 -05:00
|
|
|
// SetContextStore sets the "fake" context store
|
2023-11-20 11:38:50 -05:00
|
|
|
func (c *FakeCli) SetContextStore(contextStore store.Store) {
|
|
|
|
c.contextStore = contextStore
|
2018-11-09 09:10:41 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetCurrentContext sets the "fake" current context
|
|
|
|
func (c *FakeCli) SetCurrentContext(name string) {
|
|
|
|
c.currentContext = name
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetDockerEndpoint sets the "fake" docker endpoint
|
|
|
|
func (c *FakeCli) SetDockerEndpoint(ep docker.Endpoint) {
|
|
|
|
c.dockerEndpoint = ep
|
|
|
|
}
|
|
|
|
|
2016-12-25 16:23:35 -05:00
|
|
|
// Client returns a docker API client
|
|
|
|
func (c *FakeCli) Client() client.APIClient {
|
|
|
|
return c.client
|
|
|
|
}
|
|
|
|
|
2022-11-04 08:46:36 -04:00
|
|
|
// CurrentVersion returns the API version used by FakeCli.
|
|
|
|
func (c *FakeCli) CurrentVersion() string {
|
|
|
|
return c.DefaultVersion()
|
|
|
|
}
|
|
|
|
|
2017-02-27 12:39:35 -05:00
|
|
|
// Out returns the output stream (stdout) the cli should write on
|
2019-01-28 08:30:31 -05:00
|
|
|
func (c *FakeCli) Out() *streams.Out {
|
2017-03-30 20:21:14 -04:00
|
|
|
return c.out
|
2016-12-25 16:23:35 -05:00
|
|
|
}
|
|
|
|
|
2017-02-27 12:39:35 -05:00
|
|
|
// Err returns the output stream (stderr) the cli should write on
|
2024-06-11 10:49:25 -04:00
|
|
|
func (c *FakeCli) Err() *streams.Out {
|
2017-02-27 12:39:35 -05:00
|
|
|
return c.err
|
|
|
|
}
|
|
|
|
|
|
|
|
// In returns the input stream the cli will use
|
2019-01-28 08:30:31 -05:00
|
|
|
func (c *FakeCli) In() *streams.In {
|
2017-03-30 20:21:14 -04:00
|
|
|
return c.in
|
2016-12-25 16:23:35 -05:00
|
|
|
}
|
2017-02-27 12:39:35 -05:00
|
|
|
|
|
|
|
// ConfigFile returns the cli configfile object (to get client configuration)
|
|
|
|
func (c *FakeCli) ConfigFile() *configfile.ConfigFile {
|
|
|
|
return c.configfile
|
|
|
|
}
|
2017-06-21 15:13:44 -04:00
|
|
|
|
2018-11-09 09:10:41 -05:00
|
|
|
// ContextStore returns the cli context store
|
|
|
|
func (c *FakeCli) ContextStore() store.Store {
|
|
|
|
return c.contextStore
|
|
|
|
}
|
|
|
|
|
|
|
|
// CurrentContext returns the cli context
|
|
|
|
func (c *FakeCli) CurrentContext() string {
|
|
|
|
return c.currentContext
|
|
|
|
}
|
|
|
|
|
|
|
|
// DockerEndpoint returns the current DockerEndpoint
|
|
|
|
func (c *FakeCli) DockerEndpoint() docker.Endpoint {
|
|
|
|
return c.dockerEndpoint
|
|
|
|
}
|
|
|
|
|
2017-06-21 15:13:44 -04:00
|
|
|
// ServerInfo returns API server information for the server used by this client
|
|
|
|
func (c *FakeCli) ServerInfo() command.ServerInfo {
|
|
|
|
return c.server
|
|
|
|
}
|
2017-07-05 14:19:52 -04:00
|
|
|
|
|
|
|
// OutBuffer returns the stdout buffer
|
|
|
|
func (c *FakeCli) OutBuffer() *bytes.Buffer {
|
|
|
|
return c.outBuffer
|
|
|
|
}
|
|
|
|
|
|
|
|
// ErrBuffer Buffer returns the stderr buffer
|
|
|
|
func (c *FakeCli) ErrBuffer() *bytes.Buffer {
|
2024-06-11 10:49:25 -04:00
|
|
|
return c.errBuffer
|
2017-07-05 14:19:52 -04:00
|
|
|
}
|
2017-09-14 16:16:54 -04:00
|
|
|
|
2019-05-13 11:22:02 -04:00
|
|
|
// ResetOutputBuffers resets the .OutBuffer() and.ErrBuffer() back to empty
|
|
|
|
func (c *FakeCli) ResetOutputBuffers() {
|
|
|
|
c.outBuffer.Reset()
|
2024-06-11 10:49:25 -04:00
|
|
|
c.errBuffer.Reset()
|
2019-05-13 11:22:02 -04:00
|
|
|
}
|
|
|
|
|
2017-09-14 16:16:54 -04:00
|
|
|
// SetNotaryClient sets the internal getter for retrieving a NotaryClient
|
2018-03-08 08:35:17 -05:00
|
|
|
func (c *FakeCli) SetNotaryClient(notaryClientFunc NotaryClientFuncType) {
|
2017-09-14 16:16:54 -04:00
|
|
|
c.notaryClientFunc = notaryClientFunc
|
|
|
|
}
|
|
|
|
|
|
|
|
// NotaryClient returns an err for testing unless defined
|
|
|
|
func (c *FakeCli) NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error) {
|
|
|
|
if c.notaryClientFunc != nil {
|
|
|
|
return c.notaryClientFunc(imgRefAndAuth, actions)
|
|
|
|
}
|
linting: fmt.Errorf can be replaced with errors.New (perfsprint)
internal/test/cli.go:175:14: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("no notary client available unless defined")
^
cli/command/cli.go:318:29: fmt.Errorf can be replaced with errors.New (perfsprint)
return docker.Endpoint{}, fmt.Errorf("no context store initialized")
^
cli/command/container/attach.go:161:11: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf(result.Error.Message)
^
cli/command/container/opts.go:577:16: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("--health-start-period cannot be negative")
^
cli/command/container/opts.go:580:16: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("--health-start-interval cannot be negative")
^
cli/command/container/stats.go:221:11: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("filtering is not supported when specifying a list of containers")
^
cli/command/container/attach_test.go:82:17: fmt.Errorf can be replaced with errors.New (perfsprint)
expectedErr = fmt.Errorf("unexpected error")
^
cli/command/container/create_test.go:234:40: fmt.Errorf can be replaced with errors.New (perfsprint)
return container.CreateResponse{}, fmt.Errorf("shouldn't try to pull image")
^
cli/command/container/list_test.go:150:17: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("error listing containers")
^
cli/command/container/rm_test.go:40:31: fmt.Errorf can be replaced with errors.New (perfsprint)
return errdefs.NotFound(fmt.Errorf("Error: no such container: " + container))
^
cli/command/container/run_test.go:138:40: fmt.Errorf can be replaced with errors.New (perfsprint)
return container.CreateResponse{}, fmt.Errorf("shouldn't try to pull image")
^
cli/command/image/pull_test.go:115:49: fmt.Errorf can be replaced with errors.New (perfsprint)
return io.NopCloser(strings.NewReader("")), fmt.Errorf("shouldn't try to pull image")
^
cli/command/network/connect.go:88:16: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("invalid key/value pair format in driver options")
^
cli/command/plugin/create_test.go:96:11: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("Error creating plugin")
^
cli/command/plugin/disable_test.go:32:12: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("Error disabling plugin")
^
cli/command/plugin/enable_test.go:32:12: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("failed to enable plugin")
^
cli/command/plugin/inspect_test.go:55:22: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, nil, fmt.Errorf("error inspecting plugin")
^
cli/command/plugin/install_test.go:43:17: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("Error installing plugin")
^
cli/command/plugin/install_test.go:51:17: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("(image) when fetching")
^
cli/command/plugin/install_test.go:95:17: fmt.Errorf can be replaced with errors.New (perfsprint)
return nil, fmt.Errorf("should not try to install plugin")
^
cli/command/plugin/list_test.go:35:41: fmt.Errorf can be replaced with errors.New (perfsprint)
return types.PluginsListResponse{}, fmt.Errorf("error listing plugins")
^
cli/command/plugin/remove_test.go:27:12: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("Error removing plugin")
^
cli/command/registry/login_test.go:36:46: fmt.Errorf can be replaced with errors.New (perfsprint)
return registrytypes.AuthenticateOKBody{}, fmt.Errorf("Invalid Username or Password")
^
cli/command/registry/login_test.go:44:46: fmt.Errorf can be replaced with errors.New (perfsprint)
return registrytypes.AuthenticateOKBody{}, fmt.Errorf(errUnknownUser)
^
cli/command/system/info.go:190:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("errors pretty printing info")
^
cli/command/system/prune.go:77:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf(`ERROR: The "until" filter is not supported with "--volumes"`)
^
cli/command/system/version_test.go:19:28: fmt.Errorf can be replaced with errors.New (perfsprint)
return types.Version{}, fmt.Errorf("no server")
^
cli/command/trust/key_load.go:112:22: fmt.Errorf can be replaced with errors.New (perfsprint)
return []byte{}, fmt.Errorf("could not decrypt key")
^
cli/command/trust/revoke.go:44:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("cannot use a digest reference for IMAGE:TAG")
^
cli/command/trust/revoke.go:105:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("no signed tags to remove")
^
cli/command/trust/signer_add.go:56:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("releases is a reserved keyword, please use a different signer name")
^
cli/command/trust/signer_add.go:60:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("path to a public key must be provided using the `--key` flag")
^
opts/config.go:71:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("source is required")
^
opts/mount.go:168:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("type is required")
^
opts/mount.go:172:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("target is required")
^
opts/network.go:90:11: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("network name/id is not specified")
^
opts/network.go:129:18: fmt.Errorf can be replaced with errors.New (perfsprint)
return "", "", fmt.Errorf("invalid key value pair format in driver options")
^
opts/opts.go:404:13: fmt.Errorf can be replaced with errors.New (perfsprint)
return 0, fmt.Errorf("value is too precise")
^
opts/opts.go:412:18: fmt.Errorf can be replaced with errors.New (perfsprint)
return "", "", fmt.Errorf("empty string specified for links")
^
opts/parse.go:84:37: fmt.Errorf can be replaced with errors.New (perfsprint)
return container.RestartPolicy{}, fmt.Errorf("invalid restart policy format: no policy provided before colon")
^
opts/parse.go:89:38: fmt.Errorf can be replaced with errors.New (perfsprint)
return container.RestartPolicy{}, fmt.Errorf("invalid restart policy format: maximum retry count must be an integer")
^
opts/port.go:105:13: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("hostip is not supported")
^
opts/secret.go:70:10: fmt.Errorf can be replaced with errors.New (perfsprint)
return fmt.Errorf("source is required")
^
opts/env_test.go:57:11: fmt.Errorf can be replaced with errors.New (perfsprint)
err: fmt.Errorf("invalid environment variable: =a"),
^
opts/env_test.go:93:11: fmt.Errorf can be replaced with errors.New (perfsprint)
err: fmt.Errorf("invalid environment variable: ="),
^
cli-plugins/manager/error_test.go:16:11: fmt.Errorf can be replaced with errors.New (perfsprint)
inner := fmt.Errorf("testing")
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2024-06-10 14:47:07 -04:00
|
|
|
return nil, errors.New("no notary client available unless defined")
|
2017-09-26 18:15:04 -04:00
|
|
|
}
|
2017-06-15 14:41:54 -04:00
|
|
|
|
|
|
|
// ManifestStore returns a fake store used for testing
|
|
|
|
func (c *FakeCli) ManifestStore() manifeststore.Store {
|
|
|
|
return c.manifestStore
|
|
|
|
}
|
|
|
|
|
|
|
|
// RegistryClient returns a fake client for testing
|
2023-03-30 10:47:41 -04:00
|
|
|
func (c *FakeCli) RegistryClient(bool) registryclient.RegistryClient {
|
2017-06-15 14:41:54 -04:00
|
|
|
return c.registryClient
|
|
|
|
}
|
|
|
|
|
|
|
|
// SetManifestStore on the fake cli
|
2023-11-20 11:38:50 -05:00
|
|
|
func (c *FakeCli) SetManifestStore(manifestStore manifeststore.Store) {
|
|
|
|
c.manifestStore = manifestStore
|
2017-06-15 14:41:54 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// SetRegistryClient on the fake cli
|
2023-11-20 11:38:50 -05:00
|
|
|
func (c *FakeCli) SetRegistryClient(registryClient registryclient.RegistryClient) {
|
|
|
|
c.registryClient = registryClient
|
2017-09-14 16:16:54 -04:00
|
|
|
}
|
2018-03-08 08:35:17 -05:00
|
|
|
|
2018-03-08 14:56:56 -05:00
|
|
|
// ContentTrustEnabled on the fake cli
|
|
|
|
func (c *FakeCli) ContentTrustEnabled() bool {
|
|
|
|
return c.contentTrust
|
2018-03-08 08:35:17 -05:00
|
|
|
}
|
|
|
|
|
2018-03-08 14:56:56 -05:00
|
|
|
// EnableContentTrust on the fake cli
|
|
|
|
func EnableContentTrust(c *FakeCli) {
|
|
|
|
c.contentTrust = true
|
2018-03-08 08:35:17 -05:00
|
|
|
}
|
2022-02-24 11:57:47 -05:00
|
|
|
|
|
|
|
// BuildKitEnabled on the fake cli
|
|
|
|
func (c *FakeCli) BuildKitEnabled() (bool, error) {
|
|
|
|
return true, nil
|
|
|
|
}
|