mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 01:15:43 +03:00
add command to cli
add extra verification test
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user