diff --git a/client/driver/rkt_test.go b/client/driver/rkt_test.go index ffdbdc1e4..7da23955c 100644 --- a/client/driver/rkt_test.go +++ b/client/driver/rkt_test.go @@ -445,13 +445,16 @@ func TestRktDriver_PortsMapping(t *testing.T) { if handle == nil { t.Fatalf("missing handle") } - defer handle.Kill() + + go func() { + time.Sleep(1 * time.Second) + if err := handle.Kill(); err != nil { + t.Fatalf("Failed to kill handle: %v", err) + } + }() select { - case res := <-handle.WaitCh(): - if !res.Successful() { - t.Fatalf("err: %v", res) - } + case <-handle.WaitCh(): case <-time.After(time.Duration(testutil.TestMultiplier()*15) * time.Second): t.Fatalf("timeout") } diff --git a/command/agent/agent_test.go b/command/agent/agent_test.go index 71283dcef..735dfca97 100644 --- a/command/agent/agent_test.go +++ b/command/agent/agent_test.go @@ -43,6 +43,10 @@ func makeAgent(t testing.TB, cb func(*Config)) (string, *Agent) { config := nomad.DefaultConfig() conf.NomadConfig = config + // Set the data_dir + conf.DataDir = dir + conf.NomadConfig.DataDir = dir + // Bind and set ports conf.BindAddr = "127.0.0.1" conf.Ports = &Ports{