Time Duration fixes

This commit is contained in:
Alex Dadgar 2016-01-21 12:29:13 -08:00
parent 1ceb6f012a
commit fd21e890db
4 changed files with 5 additions and 5 deletions

View file

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

View file

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

View file

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

View file

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