diff --git a/cli/command/container/exec_test.go b/cli/command/container/exec_test.go index fb8c5c7467..ed34e4777f 100644 --- a/cli/command/container/exec_test.go +++ b/cli/command/container/exec_test.go @@ -162,7 +162,7 @@ func TestRunExec(t *testing.T) { testcases := []struct { doc string options ExecOptions - client fakeClient + client *fakeClient expectedError string expectedOut string expectedErr string @@ -172,12 +172,12 @@ func TestRunExec(t *testing.T) { options: withDefaultOpts(ExecOptions{ Detach: true, }), - client: fakeClient{execCreateFunc: execCreateWithID}, + client: &fakeClient{execCreateFunc: execCreateWithID}, }, { doc: "inspect error", options: NewExecOptions(), - client: fakeClient{ + client: &fakeClient{ inspectFunc: func(string) (types.ContainerJSON, error) { return types.ContainerJSON{}, errors.New("failed inspect") }, @@ -188,12 +188,13 @@ func TestRunExec(t *testing.T) { doc: "missing exec ID", options: NewExecOptions(), expectedError: "exec ID empty", + client: &fakeClient{}, }, } for _, testcase := range testcases { t.Run(testcase.doc, func(t *testing.T) { - fakeCLI := test.NewFakeCli(&testcase.client) + fakeCLI := test.NewFakeCli(testcase.client) err := RunExec(context.TODO(), fakeCLI, "thecontainer", testcase.options) if testcase.expectedError != "" { diff --git a/cli/command/container/logs_test.go b/cli/command/container/logs_test.go index e1d238e6f9..4a27cfaf5d 100644 --- a/cli/command/container/logs_test.go +++ b/cli/command/container/logs_test.go @@ -30,7 +30,7 @@ func TestRunLogs(t *testing.T) { testcases := []struct { doc string options *logsOptions - client fakeClient + client *fakeClient expectedError string expectedOut string expectedErr string @@ -39,13 +39,13 @@ func TestRunLogs(t *testing.T) { doc: "successful logs", expectedOut: "foo", options: &logsOptions{}, - client: fakeClient{logFunc: logFn("foo"), inspectFunc: inspectFn}, + client: &fakeClient{logFunc: logFn("foo"), inspectFunc: inspectFn}, }, } for _, testcase := range testcases { t.Run(testcase.doc, func(t *testing.T) { - cli := test.NewFakeCli(&testcase.client) + cli := test.NewFakeCli(testcase.client) err := runLogs(context.TODO(), cli, testcase.options) if testcase.expectedError != "" { diff --git a/cli/command/registry/login_test.go b/cli/command/registry/login_test.go index db88af3117..9d87ad7667 100644 --- a/cli/command/registry/login_test.go +++ b/cli/command/registry/login_test.go @@ -29,11 +29,11 @@ type fakeClient struct { client.Client } -func (c fakeClient) Info(context.Context) (system.Info, error) { +func (c *fakeClient) Info(context.Context) (system.Info, error) { return system.Info{}, nil } -func (c fakeClient) RegistryLogin(_ context.Context, auth registrytypes.AuthConfig) (registrytypes.AuthenticateOKBody, error) { +func (c *fakeClient) RegistryLogin(_ context.Context, auth registrytypes.AuthConfig) (registrytypes.AuthenticateOKBody, error) { if auth.Password == expiredPassword { return registrytypes.AuthenticateOKBody{}, errors.New("Invalid Username or Password") }