add command to cli

add extra verification test
This commit is contained in:
Chelsea Holland Komlo
2017-09-16 00:03:22 +00:00
parent 57c3ab03a0
commit 83fefabe71
3 changed files with 11 additions and 1 deletions

View File

@@ -38,7 +38,7 @@ func (c *ACLTokenInfoCommand) Synopsis() string {
}
func (c *ACLTokenInfoCommand) Run(args []string) int {
flags := c.Meta.FlagSet("acl token create", FlagSetClient)
flags := c.Meta.FlagSet("acl token info", FlagSetClient)
flags.Usage = func() { c.Ui.Output(c.Help()) }
if err := flags.Parse(args); err != nil {
return 1

View File

@@ -49,6 +49,11 @@ func TestACLTokenInfoCommand_ViaEnvVar(t *testing.T) {
code = cmd.Run([]string{"-address=" + url, mockToken.AccessorID})
assert.Equal(0, code)
// Fetch info on a token with a valid management token via a CLI option
os.Setenv("NOMAD_TOKEN", "")
code = cmd.Run([]string{"-address=" + url, "-token=" + token.SecretID, mockToken.AccessorID})
assert.Equal(0, code)
// Check the output
out := ui.OutputWriter.String()
if !strings.Contains(out, mockToken.AccessorID) {

View File

@@ -71,6 +71,11 @@ func Commands(metaPtr *command.Meta) map[string]cli.CommandFactory {
Meta: meta,
}, nil
},
"acl token info": func() (cli.Command, error) {
return &command.ACLTokenInfoCommand{
Meta: meta,
}, nil
},
"alloc-status": func() (cli.Command, error) {
return &command.AllocStatusCommand{
Meta: meta,