Update node command tests to the new golden

Also remove some superfluous tests that are now covered by a strict golden.Assert

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin
2017-08-16 12:42:19 -04:00
parent 75f7bfedf8
commit 0e2bf7420a
13 changed files with 86 additions and 140 deletions

View File

@ -1,7 +1,6 @@
package node
import (
"bytes"
"io/ioutil"
"testing"
@ -29,11 +28,10 @@ func TestNodeRemoveErrors(t *testing.T) {
},
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
cmd := newRemoveCommand(
test.NewFakeCliWithOutput(&fakeClient{
test.NewFakeCli(&fakeClient{
nodeRemoveFunc: tc.nodeRemoveFunc,
}, buf))
}))
cmd.SetArgs(tc.args)
cmd.SetOutput(ioutil.Discard)
testutil.ErrorContains(t, cmd.Execute(), tc.expectedError)
@ -41,8 +39,7 @@ func TestNodeRemoveErrors(t *testing.T) {
}
func TestNodeRemoveMultiple(t *testing.T) {
buf := new(bytes.Buffer)
cmd := newRemoveCommand(test.NewFakeCliWithOutput(&fakeClient{}, buf))
cmd := newRemoveCommand(test.NewFakeCli(&fakeClient{}))
cmd.SetArgs([]string{"nodeID1", "nodeID2"})
assert.NoError(t, cmd.Execute())
}