command: testing alloc/eval dump and short mode for status

This commit is contained in:
Ryan Uber 2015-09-15 12:53:13 -07:00
parent 8a25ca10a7
commit 1aac77c452
1 changed files with 22 additions and 0 deletions

View File

@ -59,6 +59,28 @@ func TestStatusCommand_Run(t *testing.T) {
if strings.Contains(out, "job1") || !strings.Contains(out, "job2") {
t.Fatalf("expected only job2, got: %s", out)
}
if !strings.Contains(out, "Evaluations") {
t.Fatalf("should dump evaluations")
}
if !strings.Contains(out, "Allocations") {
t.Fatalf("should dump allocations")
}
ui.OutputWriter.Reset()
// Query in short view mode
if code := cmd.Run([]string{"-address=" + url, "-short", "job2"}); code != 0 {
t.Fatalf("expected exit 0, got: %d", code)
}
out = ui.OutputWriter.String()
if !strings.Contains(out, "job2") {
t.Fatalf("expected job2, got: %s", out)
}
if strings.Contains(out, "Evaluations") {
t.Fatalf("should not dump evaluations")
}
if strings.Contains(out, "Allocations") {
t.Fatalf("should not dump allocations")
}
}
func TestStatusCommand_Fails(t *testing.T) {