Skip to content

Commit 19eeb10

Browse files
committed
cli/command/image: fix TestNewSaveCommandSuccess to actually test
This test was added in [moby@b2551c6] as part of a larger PR that implemented unit tests in various packages. In this specific test, it looks like the `imageSaveFunc` that's defined in the test-table was forgotten to be wired up, causing all tests to effectively be skipped. This patch wires up the function so that it's used in the test. [moby@b2551c6]: moby/moby@b2551c6 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent 1856229 commit 19eeb10

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)