mirror of
https://github.com/ipfs/kubo.git
synced 2025-07-03 13:00:37 +08:00
Merge pull request #475 from jbenet/fix-ctx-frac
frac ctx - skip time tests in travis
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
package ctxutil
|
package ctxutil
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -9,6 +10,10 @@ import (
|
|||||||
|
|
||||||
// this test is on the context tool itself, not our stuff. it's for sanity on ours.
|
// this test is on the context tool itself, not our stuff. it's for sanity on ours.
|
||||||
func TestDeadline(t *testing.T) {
|
func TestDeadline(t *testing.T) {
|
||||||
|
if os.Getenv("TRAVIS") == "true" {
|
||||||
|
t.Skip("timeouts don't work reliably on travis")
|
||||||
|
}
|
||||||
|
|
||||||
ctx, _ := context.WithTimeout(context.Background(), 5*time.Millisecond)
|
ctx, _ := context.WithTimeout(context.Background(), 5*time.Millisecond)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
@ -37,6 +42,9 @@ func TestDeadlineFractionForever(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDeadlineFractionHalf(t *testing.T) {
|
func TestDeadlineFractionHalf(t *testing.T) {
|
||||||
|
if os.Getenv("TRAVIS") == "true" {
|
||||||
|
t.Skip("timeouts don't work reliably on travis")
|
||||||
|
}
|
||||||
|
|
||||||
ctx1, _ := context.WithTimeout(context.Background(), 10*time.Millisecond)
|
ctx1, _ := context.WithTimeout(context.Background(), 10*time.Millisecond)
|
||||||
ctx2, _ := WithDeadlineFraction(ctx1, 0.5)
|
ctx2, _ := WithDeadlineFraction(ctx1, 0.5)
|
||||||
|
Reference in New Issue
Block a user