From 8c9c281100c16e615e9e4ef34a859ddff3198944 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Gronowski?= Date: Fri, 24 Feb 2023 10:13:54 +0100 Subject: [PATCH] test/cli: Use empty array as empty output of images/json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tests mocking the output of GET images/json with fakeClient used an array with one empty element as an empty response. Change it to just an empty array. Signed-off-by: Paweł Gronowski (cherry picked from commit a1953e19b266126bdbf906dfd06b735d73d8d27c) --- cli/command/image/client_test.go | 2 +- cli/command/image/list_test.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/command/image/client_test.go b/cli/command/image/client_test.go index 50e46f4ec1..ffd733d00d 100644 --- a/cli/command/image/client_test.go +++ b/cli/command/image/client_test.go @@ -91,7 +91,7 @@ func (cli *fakeClient) ImageList(ctx context.Context, options types.ImageListOpt if cli.imageListFunc != nil { return cli.imageListFunc(options) } - return []types.ImageSummary{{}}, nil + return []types.ImageSummary{}, nil } func (cli *fakeClient) ImageInspectWithRaw(_ context.Context, image string) (types.ImageInspect, []byte, error) { diff --git a/cli/command/image/list_test.go b/cli/command/image/list_test.go index 4ada775527..2f8a7db556 100644 --- a/cli/command/image/list_test.go +++ b/cli/command/image/list_test.go @@ -30,7 +30,7 @@ func TestNewImagesCommandErrors(t *testing.T) { name: "failed-list", expectedError: "something went wrong", imageListFunc: func(options types.ImageListOptions) ([]types.ImageSummary, error) { - return []types.ImageSummary{{}}, errors.Errorf("something went wrong") + return []types.ImageSummary{}, errors.Errorf("something went wrong") }, }, } @@ -66,7 +66,7 @@ func TestNewImagesCommandSuccess(t *testing.T) { args: []string{"image"}, imageListFunc: func(options types.ImageListOptions) ([]types.ImageSummary, error) { assert.Check(t, is.Equal("image", options.Filters.Get("reference")[0])) - return []types.ImageSummary{{}}, nil + return []types.ImageSummary{}, nil }, }, { @@ -74,7 +74,7 @@ func TestNewImagesCommandSuccess(t *testing.T) { args: []string{"--filter", "name=value"}, imageListFunc: func(options types.ImageListOptions) ([]types.ImageSummary, error) { assert.Check(t, is.Equal("value", options.Filters.Get("name")[0])) - return []types.ImageSummary{{}}, nil + return []types.ImageSummary{}, nil }, }, }