fix two flaky tests

This commit is contained in:
Alex Dadgar
2017-10-23 17:57:00 -07:00
parent 8accabcd87
commit 366e91276f
2 changed files with 10 additions and 4 deletions

View File

@@ -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)
}

View File

@@ -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()
}