Skip to content

Commit b64f265

Browse files
authored
Merge pull request #5520 from thaJeztah/fix_TestNewSaveCommandSuccess
cli/command/image: fix TestNewSaveCommandSuccess to actually test
2 parents 1856229 + 19eeb10 commit b64f265

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

cli/command/image/save_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@ func TestNewSaveCommandSuccess(t *testing.T) {
7070
testCases := []struct {
7171
args []string
7272
isTerminal bool
73-
imageSaveFunc func(images []string) (io.ReadCloser, error)
73+
imageSaveFunc func(images []string, options image.SaveOptions) (io.ReadCloser, error)
7474
deferredFunc func()
7575
}{
7676
{
7777
args: []string{"-o", "save_tmp_file", "arg1"},
7878
isTerminal: true,
79-
imageSaveFunc: func(images []string) (io.ReadCloser, error) {
79+
imageSaveFunc: func(images []string, _ image.SaveOptions) (io.ReadCloser, error) {
8080
assert.Assert(t, is.Len(images, 1))
8181
assert.Check(t, is.Equal("arg1", images[0]))
8282
return io.NopCloser(strings.NewReader("")), nil
@@ -88,7 +88,7 @@ func TestNewSaveCommandSuccess(t *testing.T) {
8888
{
8989
args: []string{"arg1", "arg2"},
9090
isTerminal: false,
91-
imageSaveFunc: func(images []string) (io.ReadCloser, error) {
91+
imageSaveFunc: func(images []string, _ image.SaveOptions) (io.ReadCloser, error) {
9292
assert.Assert(t, is.Len(images, 2))
9393
assert.Check(t, is.Equal("arg1", images[0]))
9494
assert.Check(t, is.Equal("arg2", images[1]))
@@ -100,9 +100,7 @@ func TestNewSaveCommandSuccess(t *testing.T) {
100100
tc := tc
101101
t.Run(strings.Join(tc.args, " "), func(t *testing.T) {
102102
cmd := NewSaveCommand(test.NewFakeCli(&fakeClient{
103-
imageSaveFunc: func(images []string, options image.SaveOptions) (io.ReadCloser, error) {
104-
return io.NopCloser(strings.NewReader("")), nil
105-
},
103+
imageSaveFunc: tc.imageSaveFunc,
106104
}))
107105
cmd.SetOut(io.Discard)
108106
cmd.SetErr(io.Discard)

0 commit comments

Comments
 (0)