Skip to content

Commit

Permalink
SQUASH: Change to use Err instead of Out
Browse files Browse the repository at this point in the history
Signed-off-by: Marcus Martins <marcus@docker.com>
  • Loading branch information
marcusmartins committed May 26, 2017
1 parent 6cd3a60 commit 7c5777e
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 14 deletions.
5 changes: 1 addition & 4 deletions cli/command/image/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,7 @@ func TestNewPullCommandSuccess(t *testing.T) {
}
for _, tc := range testCases {
buf := new(bytes.Buffer)
infoFunc := func() (types.Info, error) {
return types.Info{IndexServerAddress: registry.IndexServer}, nil
}
cmd := NewPullCommand(test.NewFakeCli(&fakeClient{infoFunc: infoFunc}, buf))
cmd := NewPullCommand(test.NewFakeCli(&fakeClient{}, buf))
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
err := cmd.Execute()
Expand Down
4 changes: 2 additions & 2 deletions cli/command/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ func ElectAuthServer(ctx context.Context, cli Cli) string {
// the default registry URL might be Windows specific.
serverAddress := registry.IndexServer
if info, err := cli.Client().Info(ctx); err != nil {
fmt.Fprintf(cli.Out(), "Warning: failed to get default registry endpoint from daemon (%v). Using system default: %s\n", err, serverAddress)
fmt.Fprintf(cli.Err(), "Warning: failed to get default registry endpoint from daemon (%v). Using system default: %s\n", err, serverAddress)
} else if info.IndexServerAddress == "" {
fmt.Fprintf(cli.Out(), "Warning: Empty registry endpoint from daemon. Using system default: %s\n", serverAddress)
fmt.Fprintf(cli.Err(), "Warning: Empty registry endpoint from daemon. Using system default: %s\n", serverAddress)
} else {
serverAddress = info.IndexServerAddress
}
Expand Down
6 changes: 3 additions & 3 deletions cli/command/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ func TestElectAuthServer(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{infoFunc: tc.infoFunc}, buf)
outBuf := new(bytes.Buffer)
cli.SetOut(outBuf)
errBuf := new(bytes.Buffer)
cli.SetErr(errBuf)
server := ElectAuthServer(context.Background(), cli)
assert.Equal(t, tc.expectedAuthServer, server)
actual := outBuf.String()
actual := errBuf.String()
if tc.expectedWarning == "" {
assert.Empty(t, actual)
} else {
Expand Down
5 changes: 0 additions & 5 deletions cli/internal/test/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,6 @@ func (c *FakeCli) SetErr(err io.Writer) {
c.err = err
}

// SetOut sets the Out stream for the cli to the specified io.Writer
func (c *FakeCli) SetOut(out io.Writer) {
c.out = command.NewOutStream(out)
}

// SetConfigfile sets the "fake" config file
func (c *FakeCli) SetConfigfile(configfile *configfile.ConfigFile) {
c.configfile = configfile
Expand Down

0 comments on commit 7c5777e

Please sign in to comment.