Skip to content

Commit d352c50

Browse files
authored
Merge pull request #4061 from vvoland/test-fakecli-images-mock-23
[23.0 backport] test/cli: Use empty array as empty output of images/json
2 parents 28c74b7 + 14ac8db commit d352c50

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cli/command/image/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ func (cli *fakeClient) ImageList(ctx context.Context, options types.ImageListOpt
9191
if cli.imageListFunc != nil {
9292
return cli.imageListFunc(options)
9393
}
94-
return []types.ImageSummary{{}}, nil
94+
return []types.ImageSummary{}, nil
9595
}
9696

9797
func (cli *fakeClient) ImageInspectWithRaw(_ context.Context, image string) (types.ImageInspect, []byte, error) {

cli/command/image/list_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestNewImagesCommandErrors(t *testing.T) {
3030
name: "failed-list",
3131
expectedError: "something went wrong",
3232
imageListFunc: func(options types.ImageListOptions) ([]types.ImageSummary, error) {
33-
return []types.ImageSummary{{}}, errors.Errorf("something went wrong")
33+
return []types.ImageSummary{}, errors.Errorf("something went wrong")
3434
},
3535
},
3636
}
@@ -66,15 +66,15 @@ func TestNewImagesCommandSuccess(t *testing.T) {
6666
args: []string{"image"},
6767
imageListFunc: func(options types.ImageListOptions) ([]types.ImageSummary, error) {
6868
assert.Check(t, is.Equal("image", options.Filters.Get("reference")[0]))
69-
return []types.ImageSummary{{}}, nil
69+
return []types.ImageSummary{}, nil
7070
},
7171
},
7272
{
7373
name: "filters",
7474
args: []string{"--filter", "name=value"},
7575
imageListFunc: func(options types.ImageListOptions) ([]types.ImageSummary, error) {
7676
assert.Check(t, is.Equal("value", options.Filters.Get("name")[0]))
77-
return []types.ImageSummary{{}}, nil
77+
return []types.ImageSummary{}, nil
7878
},
7979
},
8080
}

0 commit comments

Comments
 (0)