From 366e91276fbf7478f433e826ee32ebebd168d05b Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Mon, 23 Oct 2017 17:57:00 -0700 Subject: [PATCH] fix two flaky tests --- client/driver/raw_exec_test.go | 8 +++++++- command/run_test.go | 6 +++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/client/driver/raw_exec_test.go b/client/driver/raw_exec_test.go index 0060653d2..dadaf0738 100644 --- a/client/driver/raw_exec_test.go +++ b/client/driver/raw_exec_test.go @@ -265,7 +265,7 @@ func TestRawExecDriver_HandlerExec(t *testing.T) { Driver: "raw_exec", Config: map[string]interface{}{ "command": testtask.Path(), - "args": []string{"sleep", "9000"}, + "args": []string{"sleep", "9000s"}, }, LogConfig: &structs.LogConfig{ MaxFiles: 10, @@ -310,6 +310,12 @@ func TestRawExecDriver_HandlerExec(t *testing.T) { t.Fatalf("expected output to contain %q but found: %q", expected, out) } + select { + case res := <-resp.Handle.WaitCh(): + t.Fatalf("Shouldn't be exited: %v", res.String()) + default: + } + if err := resp.Handle.Kill(); err != nil { t.Fatalf("error killing exec handle: %v", err) } diff --git a/command/run_test.go b/command/run_test.go index 715778d43..c42b3da43 100644 --- a/command/run_test.go +++ b/command/run_test.go @@ -188,13 +188,13 @@ job "job1" { stdinW.Close() }() - args := []string{"-"} + args := []string{"-address=nope", "-"} if code := cmd.Run(args); code != 1 { t.Fatalf("expected exit code 1, got %d: %q", code, ui.ErrorWriter.String()) } - if out := ui.ErrorWriter.String(); !strings.Contains(out, "connection refused") { - t.Fatalf("expected connection refused error, got: %s", out) + if out := ui.ErrorWriter.String(); !strings.Contains(out, "Error submitting job") { + t.Fatalf("expected submission error, got: %s", out) } ui.ErrorWriter.Reset() }