Skip to content

Commit

Permalink
Fix comment and misc code issues
Browse files Browse the repository at this point in the history
Signed-off-by: Nassim 'Nass' Eddequiouaq <eddequiouaq.nassim@gmail.com>
  • Loading branch information
n4ss committed Mar 9, 2018
1 parent c5554f8 commit 6cfc125
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions cli/command/trust/inspect.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import (

type inspectOptions struct {
remotes []string
/* FIXME(n4ss): this is consistent with `docker service inspect` but we should provide
* a `--format` flag too. (format and pretty-print should be exclusive)
*/
// FIXME(n4ss): this is consistent with `docker service inspect` but we should provide
// a `--format` flag too. (format and pretty-print should be exclusive)
prettyPrint bool
}

Expand Down Expand Up @@ -49,7 +48,7 @@ func runInspect(dockerCli command.Cli, opts inspectOptions) error {
}

// Additional separator between the inspection output of each image
if index < len(opts.remotes) - 1 {
if index < len(opts.remotes)-1 {
fmt.Fprint(dockerCli.Out(), "\n\n")
}
}
Expand Down
12 changes: 6 additions & 6 deletions cli/command/trust/inspect_pretty_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/theupdateframework/notary/tuf/data"
)

/* TODO(n4ss): remove common tests with the regular inspect command */
// TODO(n4ss): remove common tests with the regular inspect command

type fakeClient struct {
dockerClient.Client
Expand Down Expand Up @@ -65,7 +65,7 @@ func TestTrustInspectPrettyCommandOfflineErrors(t *testing.T) {

cli = test.NewFakeCli(&fakeClient{})
cli.SetNotaryClient(notaryfake.GetOfflineNotaryRepository)
cmd := newInspectCommand(cli)
cmd = newInspectCommand(cli)
cmd.Flags().Set("pretty", "true")
cmd.SetArgs([]string{"nonexistent-reg-name.io/image:tag"})
cmd.SetOutput(ioutil.Discard)
Expand All @@ -83,7 +83,7 @@ func TestTrustInspectPrettyCommandUninitializedErrors(t *testing.T) {

cli = test.NewFakeCli(&fakeClient{})
cli.SetNotaryClient(notaryfake.GetUninitializedNotaryRepository)
cmd := newInspectCommand(cli)
cmd = newInspectCommand(cli)
cmd.Flags().Set("pretty", "true")
cmd.SetArgs([]string{"reg/unsigned-img:tag"})
cmd.SetOutput(ioutil.Discard)
Expand All @@ -99,17 +99,17 @@ func TestTrustInspectPrettyCommandEmptyNotaryRepoErrors(t *testing.T) {
cmd.SetOutput(ioutil.Discard)
assert.NilError(t, cmd.Execute())
assert.Check(t, is.Contains(cli.OutBuffer().String(), "No signatures for reg/img:unsigned-tag"))
assert.Check(t, is.Contains(cli.OutBuffer().String(), "Administrative keys for reg/img:"))
assert.Check(t, is.Contains(cli.OutBuffer().String(), "Administrative keys for reg/img"))

cli = test.NewFakeCli(&fakeClient{})
cli.SetNotaryClient(notaryfake.GetEmptyTargetsNotaryRepository)
cmd := newInspectCommand(cli)
cmd = newInspectCommand(cli)
cmd.Flags().Set("pretty", "true")
cmd.SetArgs([]string{"reg/img"})
cmd.SetOutput(ioutil.Discard)
assert.NilError(t, cmd.Execute())
assert.Check(t, is.Contains(cli.OutBuffer().String(), "No signatures for reg/img"))
assert.Check(t, is.Contains(cli.OutBuffer().String(), "Administrative keys for reg/img:"))
assert.Check(t, is.Contains(cli.OutBuffer().String(), "Administrative keys for reg/img"))
}

func TestTrustInspectPrettyCommandFullRepoWithoutSigners(t *testing.T) {
Expand Down

0 comments on commit 6cfc125

Please sign in to comment.