command: better test for alloc-status
This commit is contained in:
parent
76a3cf3b93
commit
53e676f42a
|
@ -12,6 +12,9 @@ func TestAllocStatusCommand_Implements(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestAllocStatusCommand_Fails(t *testing.T) {
|
||||
srv, _, url := testServer(t, nil)
|
||||
defer srv.Stop()
|
||||
|
||||
ui := new(cli.MockUi)
|
||||
cmd := &AllocStatusCommand{Meta: Meta{Ui: ui}}
|
||||
|
||||
|
@ -31,4 +34,12 @@ func TestAllocStatusCommand_Fails(t *testing.T) {
|
|||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error querying allocation") {
|
||||
t.Fatalf("expected failed query error, got: %s", out)
|
||||
}
|
||||
|
||||
// Fails on missing alloc
|
||||
if code := cmd.Run([]string{"-address=" + url, "26470238-5CF2-438F-8772-DC67CFB0705C"}); code != 1 {
|
||||
t.Fatalf("expected exit 1, got: %d", code)
|
||||
}
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "not found") {
|
||||
t.Fatalf("expected not found error, got: %s", out)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue