command.plan: tiny: Fix expect error code message from 1 to 255
This commit is contained in:
parent
88c5eaf806
commit
cb94b1ae50
|
@ -28,7 +28,7 @@ func TestPlanCommand_Fails(t *testing.T) {
|
|||
|
||||
// Fails when specified file does not exist
|
||||
if code := cmd.Run([]string{"/unicorns/leprechauns"}); code != 255 {
|
||||
t.Fatalf("expect exit 1, got: %d", code)
|
||||
t.Fatalf("expect exit 255, got: %d", code)
|
||||
}
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error getting job struct") {
|
||||
t.Fatalf("expect getting job struct error, got: %s", out)
|
||||
|
@ -45,7 +45,7 @@ func TestPlanCommand_Fails(t *testing.T) {
|
|||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if code := cmd.Run([]string{fh1.Name()}); code != 255 {
|
||||
t.Fatalf("expect exit 1, got: %d", code)
|
||||
t.Fatalf("expect exit 255, got: %d", code)
|
||||
}
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error getting job struct") {
|
||||
t.Fatalf("expect parsing error, got: %s", out)
|
||||
|
@ -62,7 +62,7 @@ func TestPlanCommand_Fails(t *testing.T) {
|
|||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if code := cmd.Run([]string{fh2.Name()}); code != 255 {
|
||||
t.Fatalf("expect exit 1, got: %d", code)
|
||||
t.Fatalf("expect exit 255, got: %d", code)
|
||||
}
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error validating") {
|
||||
t.Fatalf("expect validation error, got: %s", out)
|
||||
|
@ -95,7 +95,7 @@ job "job1" {
|
|||
t.Fatalf("err: %s", err)
|
||||
}
|
||||
if code := cmd.Run([]string{"-address=nope", fh3.Name()}); code != 255 {
|
||||
t.Fatalf("expected exit code 1, got: %d", code)
|
||||
t.Fatalf("expected exit code 255, got: %d", code)
|
||||
}
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error during plan") {
|
||||
t.Fatalf("expected failed query error, got: %s", out)
|
||||
|
@ -147,13 +147,13 @@ job "job1" {
|
|||
|
||||
func TestPlanCommand_From_URL(t *testing.T) {
|
||||
ui := new(cli.MockUi)
|
||||
cmd := &RunCommand{
|
||||
cmd := &PlanCommand{
|
||||
Meta: Meta{Ui: ui},
|
||||
}
|
||||
|
||||
args := []string{"https://example.com/foo/bar"}
|
||||
if code := cmd.Run(args); code != 1 {
|
||||
t.Fatalf("expected exit code 1, got %d: %q", code, ui.ErrorWriter.String())
|
||||
if code := cmd.Run(args); code != 255 {
|
||||
t.Fatalf("expected exit code 255, got %d: %q", code, ui.ErrorWriter.String())
|
||||
}
|
||||
|
||||
if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error getting jobfile") {
|
||||
|
|
Loading…
Reference in New Issue