diff --git a/command/alloc_status_test.go b/command/alloc_status_test.go index c8478bb7a..090ebb0eb 100644 --- a/command/alloc_status_test.go +++ b/command/alloc_status_test.go @@ -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) + } }