From 756738d9f141bf901a112e5ef3e3c4ef626aa101 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Tue, 15 Nov 2016 15:49:05 -0800 Subject: [PATCH] Fix TestRktDriver_PortsMapping and TestAgent_LoadKeyrings --- client/driver/rkt_test.go | 13 ++++++++----- command/agent/agent_test.go | 4 ++++ 2 files changed, 12 insertions(+), 5 deletions(-) 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{