Merge pull request #4060 from vvoland/test-fakecli-images-mock-2010

[20.10 backport] test/cli: Use empty array as empty output of images/json
This commit is contained in:
Sebastiaan van Stijn 2023-03-03 16:29:46 +01:00 committed by GitHub
commit 3825ed5f7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -90,7 +90,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) {

View File

@ -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
},
},
}