mirror of
https://github.com/kemko/nomad.git
synced 2026-01-04 17:35:43 +03:00
Fix tests
This commit is contained in:
@@ -18,7 +18,7 @@ func TestPlanCommand_Fails(t *testing.T) {
|
||||
cmd := &PlanCommand{Meta: Meta{Ui: ui}}
|
||||
|
||||
// Fails on misuse
|
||||
if code := cmd.Run([]string{"some", "bad", "args"}); code != 1 {
|
||||
if code := cmd.Run([]string{"some", "bad", "args"}); code != 255 {
|
||||
t.Fatalf("expected exit code 1, got: %d", code)
|
||||
}
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, cmd.Help()) {
|
||||
@@ -27,7 +27,7 @@ func TestPlanCommand_Fails(t *testing.T) {
|
||||
ui.ErrorWriter.Reset()
|
||||
|
||||
// Fails when specified file does not exist
|
||||
if code := cmd.Run([]string{"/unicorns/leprechauns"}); code != 1 {
|
||||
if code := cmd.Run([]string{"/unicorns/leprechauns"}); code != 255 {
|
||||
t.Fatalf("expect exit 1, got: %d", code)
|
||||
}
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error opening") {
|
||||
@@ -44,7 +44,7 @@ func TestPlanCommand_Fails(t *testing.T) {
|
||||
if _, err := fh1.WriteString("nope"); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if code := cmd.Run([]string{fh1.Name()}); code != 1 {
|
||||
if code := cmd.Run([]string{fh1.Name()}); code != 255 {
|
||||
t.Fatalf("expect exit 1, got: %d", code)
|
||||
}
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error parsing") {
|
||||
@@ -61,7 +61,7 @@ func TestPlanCommand_Fails(t *testing.T) {
|
||||
if _, err := fh2.WriteString(`job "job1" {}`); err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if code := cmd.Run([]string{fh2.Name()}); code != 1 {
|
||||
if code := cmd.Run([]string{fh2.Name()}); code != 255 {
|
||||
t.Fatalf("expect exit 1, got: %d", code)
|
||||
}
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error validating") {
|
||||
@@ -94,7 +94,7 @@ job "job1" {
|
||||
if err != nil {
|
||||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if code := cmd.Run([]string{"-address=nope", fh3.Name()}); code != 1 {
|
||||
if code := cmd.Run([]string{"-address=nope", fh3.Name()}); code != 255 {
|
||||
t.Fatalf("expected exit code 1, got: %d", code)
|
||||
}
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error during plan") {
|
||||
@@ -135,7 +135,7 @@ job "job1" {
|
||||
}()
|
||||
|
||||
args := []string{"-"}
|
||||
if code := cmd.Run(args); code != 1 {
|
||||
if code := cmd.Run(args); code != 255 {
|
||||
t.Fatalf("expected exit code 1, got %d: %q", code, ui.ErrorWriter.String())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user