Browse Source

Merge pull request #6594 from heyitsanthony/e2e-etcdctl-timeout

e2e: print correct timeout for etcdctl tests
Anthony Romano 9 years ago
parent
commit
b8079b7fc0
1 changed files with 6 additions and 4 deletions
  1. 6 4
      e2e/ctl_v3_test.go

+ 6 - 4
e2e/ctl_v3_test.go

@@ -144,11 +144,13 @@ func testCtl(t *testing.T, testFunc func(ctlCtx), opts ...ctlOption) {
 		testFunc(ret)
 		testFunc(ret)
 	}()
 	}()
 
 
+	timeout := 2*ret.dialTimeout + time.Second
+	if ret.dialTimeout == 0 {
+		timeout = 30 * time.Second
+	}
 	select {
 	select {
-	case <-time.After(2*ret.dialTimeout + time.Second):
-		if ret.dialTimeout > 0 {
-			t.Fatalf("test timed out for %v", ret.dialTimeout)
-		}
+	case <-time.After(timeout):
+		t.Fatalf("test timed out after %v", timeout)
 	case <-donec:
 	case <-donec:
 	}
 	}
 }
 }