mirror of https://github.com/docker/cli.git
Merge pull request #5520 from thaJeztah/fix_TestNewSaveCommandSuccess
cli/command/image: fix TestNewSaveCommandSuccess to actually test
This commit is contained in:
commit
b64f265d0f
|
@ -70,13 +70,13 @@ func TestNewSaveCommandSuccess(t *testing.T) {
|
||||||
testCases := []struct {
|
testCases := []struct {
|
||||||
args []string
|
args []string
|
||||||
isTerminal bool
|
isTerminal bool
|
||||||
imageSaveFunc func(images []string) (io.ReadCloser, error)
|
imageSaveFunc func(images []string, options image.SaveOptions) (io.ReadCloser, error)
|
||||||
deferredFunc func()
|
deferredFunc func()
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
args: []string{"-o", "save_tmp_file", "arg1"},
|
args: []string{"-o", "save_tmp_file", "arg1"},
|
||||||
isTerminal: true,
|
isTerminal: true,
|
||||||
imageSaveFunc: func(images []string) (io.ReadCloser, error) {
|
imageSaveFunc: func(images []string, _ image.SaveOptions) (io.ReadCloser, error) {
|
||||||
assert.Assert(t, is.Len(images, 1))
|
assert.Assert(t, is.Len(images, 1))
|
||||||
assert.Check(t, is.Equal("arg1", images[0]))
|
assert.Check(t, is.Equal("arg1", images[0]))
|
||||||
return io.NopCloser(strings.NewReader("")), nil
|
return io.NopCloser(strings.NewReader("")), nil
|
||||||
|
@ -88,7 +88,7 @@ func TestNewSaveCommandSuccess(t *testing.T) {
|
||||||
{
|
{
|
||||||
args: []string{"arg1", "arg2"},
|
args: []string{"arg1", "arg2"},
|
||||||
isTerminal: false,
|
isTerminal: false,
|
||||||
imageSaveFunc: func(images []string) (io.ReadCloser, error) {
|
imageSaveFunc: func(images []string, _ image.SaveOptions) (io.ReadCloser, error) {
|
||||||
assert.Assert(t, is.Len(images, 2))
|
assert.Assert(t, is.Len(images, 2))
|
||||||
assert.Check(t, is.Equal("arg1", images[0]))
|
assert.Check(t, is.Equal("arg1", images[0]))
|
||||||
assert.Check(t, is.Equal("arg2", images[1]))
|
assert.Check(t, is.Equal("arg2", images[1]))
|
||||||
|
@ -100,9 +100,7 @@ func TestNewSaveCommandSuccess(t *testing.T) {
|
||||||
tc := tc
|
tc := tc
|
||||||
t.Run(strings.Join(tc.args, " "), func(t *testing.T) {
|
t.Run(strings.Join(tc.args, " "), func(t *testing.T) {
|
||||||
cmd := NewSaveCommand(test.NewFakeCli(&fakeClient{
|
cmd := NewSaveCommand(test.NewFakeCli(&fakeClient{
|
||||||
imageSaveFunc: func(images []string, options image.SaveOptions) (io.ReadCloser, error) {
|
imageSaveFunc: tc.imageSaveFunc,
|
||||||
return io.NopCloser(strings.NewReader("")), nil
|
|
||||||
},
|
|
||||||
}))
|
}))
|
||||||
cmd.SetOut(io.Discard)
|
cmd.SetOut(io.Discard)
|
||||||
cmd.SetErr(io.Discard)
|
cmd.SetErr(io.Discard)
|
||||||
|
|
Loading…
Reference in New Issue