From fd21e890db18c08ae4e59b79e4cf0c97012f0872 Mon Sep 17 00:00:00 2001 From: Alex Dadgar Date: Thu, 21 Jan 2016 12:29:13 -0800 Subject: [PATCH] Time Duration fixes --- client/driver/exec_test.go | 2 +- client/driver/raw_exec_test.go | 2 +- client/task_runner_test.go | 2 +- testutil/wait.go | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/driver/exec_test.go b/client/driver/exec_test.go index b1f01b3c3..6bce6b650 100644 --- a/client/driver/exec_test.go +++ b/client/driver/exec_test.go @@ -237,7 +237,7 @@ func TestExecDriver_Start_Wait_AllocDir(t *testing.T) { if !res.Successful() { t.Fatalf("err: %v", res) } - case <-time.After(testutil.TestMultiplier() * 2 * time.Second): + case <-time.After(time.Duration(testutil.TestMultiplier()*2) * time.Second): t.Fatalf("timeout") } diff --git a/client/driver/raw_exec_test.go b/client/driver/raw_exec_test.go index 5238da2b2..2a16847d8 100644 --- a/client/driver/raw_exec_test.go +++ b/client/driver/raw_exec_test.go @@ -304,7 +304,7 @@ func TestRawExecDriver_Start_Kill_Wait(t *testing.T) { } go func() { - time.Sleep(testutil.TestMultiplier() * 1 * time.Second) + time.Sleep(time.Duration(testutil.TestMultiplier()*1) * time.Second) err := handle.Kill() if err != nil { t.Fatalf("err: %v", err) diff --git a/client/task_runner_test.go b/client/task_runner_test.go index 3c9db8ac6..6938d39a4 100644 --- a/client/task_runner_test.go +++ b/client/task_runner_test.go @@ -175,7 +175,7 @@ func TestTaskRunner_SaveRestoreState(t *testing.T) { defer tr2.Destroy() // Destroy and wait - time.Sleep(testutil.TestMultiplier() * 2 * time.Second) + time.Sleep(time.Duration(testutil.TestMultiplier()*2) * time.Second) if tr2.handle == nil { t.Fatalf("RestoreState() didn't open handle") } diff --git a/testutil/wait.go b/testutil/wait.go index 05406c9c4..097dd4619 100644 --- a/testutil/wait.go +++ b/testutil/wait.go @@ -21,7 +21,7 @@ func WaitForResult(test testFn, error errorFn) { WaitForResultRetries(1000*TestMultiplier(), test, error) } -func WaitForResultRetries(retries int, test testFn, error errorFn) { +func WaitForResultRetries(retries int64, test testFn, error errorFn) { for retries > 0 { time.Sleep(10 * time.Millisecond) retries-- @@ -39,7 +39,7 @@ func WaitForResultRetries(retries int, test testFn, error errorFn) { // TestMultiplier returns a multiplier for retries and waits given environment // the tests are being run under. -func TestMultiplier() int { +func TestMultiplier() int64 { if _, ok := os.LookupEnv(TravisRunEnv); ok { return 3 }