From b9b39391e592df70eafaa287dafbb952760ddf65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Thu, 13 Sep 2018 10:35:03 +0100 Subject: [PATCH] attempt to fix time-dependent tests in CI. --- p2p/host/peerstore/test/addr_book_suite.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/p2p/host/peerstore/test/addr_book_suite.go b/p2p/host/peerstore/test/addr_book_suite.go index b103aecc7c..d78e7ccd34 100644 --- a/p2p/host/peerstore/test/addr_book_suite.go +++ b/p2p/host/peerstore/test/addr_book_suite.go @@ -209,28 +209,28 @@ func testAddressesExpire(m pstore.AddrBook) func(t *testing.T) { testHas(t, addrs1, m.Addrs(ids[0])) testHas(t, addrs2, m.Addrs(ids[1])) - m.SetAddr(ids[0], addrs1[0], time.Millisecond) - <-time.After(time.Millisecond * 5) + m.SetAddr(ids[0], addrs1[0], 100*time.Microsecond) + <-time.After(100 * time.Millisecond) testHas(t, addrs1[1:3], m.Addrs(ids[0])) testHas(t, addrs2, m.Addrs(ids[1])) - m.SetAddr(ids[0], addrs1[2], time.Millisecond) - <-time.After(time.Millisecond * 5) + m.SetAddr(ids[0], addrs1[2], 100*time.Microsecond) + <-time.After(100 * time.Millisecond) testHas(t, addrs1[1:2], m.Addrs(ids[0])) testHas(t, addrs2, m.Addrs(ids[1])) - m.SetAddr(ids[1], addrs2[0], time.Millisecond) - <-time.After(time.Millisecond * 5) + m.SetAddr(ids[1], addrs2[0], 100*time.Microsecond) + <-time.After(100 * time.Millisecond) testHas(t, addrs1[1:2], m.Addrs(ids[0])) testHas(t, addrs2[1:], m.Addrs(ids[1])) - m.SetAddr(ids[1], addrs2[1], time.Millisecond) - <-time.After(time.Millisecond * 5) + m.SetAddr(ids[1], addrs2[1], 100*time.Microsecond) + <-time.After(100 * time.Millisecond) testHas(t, addrs1[1:2], m.Addrs(ids[0])) testHas(t, nil, m.Addrs(ids[1])) - m.SetAddr(ids[0], addrs1[1], time.Millisecond) - <-time.After(time.Millisecond * 5) + m.SetAddr(ids[0], addrs1[1], 100*time.Microsecond) + <-time.After(100 * time.Millisecond) testHas(t, nil, m.Addrs(ids[0])) testHas(t, nil, m.Addrs(ids[1])) }