Skip to content

Commit

Permalink
Merge pull request #160 from libp2p/web3-bot/sync
Browse files Browse the repository at this point in the history
sync: update CI config files
  • Loading branch information
Stebalien committed Jul 17, 2021
2 parents 827acb2 + eeff701 commit 27386f6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
10 changes: 5 additions & 5 deletions p2p/host/peerstore/pstoreds/addr_book_gc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestGCLookahead(t *testing.T) {
opts.GCLookaheadInterval = 10 * time.Second
opts.GCPurgeInterval = 1 * time.Second

factory := addressBookFactory(t, badgerStore, opts)
factory := addressBookFactory(t, leveldbStore, opts)
ab, closeFn := factory()
gc := ab.(*dsAddrBook).gc
defer closeFn()
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestGCPurging(t *testing.T) {
opts.GCLookaheadInterval = 20 * time.Second
opts.GCPurgeInterval = 1 * time.Second

factory := addressBookFactory(t, badgerStore, opts)
factory := addressBookFactory(t, leveldbStore, opts)
ab, closeFn := factory()
gc := ab.(*dsAddrBook).gc
defer closeFn()
Expand Down Expand Up @@ -157,7 +157,7 @@ func TestGCDelay(t *testing.T) {
opts.GCLookaheadInterval = 1 * time.Minute
opts.GCPurgeInterval = 30 * time.Second

factory := addressBookFactory(t, badgerStore, opts)
factory := addressBookFactory(t, leveldbStore, opts)
ab, closeFn := factory()
defer closeFn()

Expand Down Expand Up @@ -188,7 +188,7 @@ func TestGCLookaheadDisabled(t *testing.T) {
opts.GCLookaheadInterval = 0 // disable lookahead
opts.GCPurgeInterval = 9 * time.Hour

factory := addressBookFactory(t, badgerStore, opts)
factory := addressBookFactory(t, leveldbStore, opts)
ab, closeFn := factory()
defer closeFn()

Expand Down Expand Up @@ -232,7 +232,7 @@ func BenchmarkLookaheadCycle(b *testing.B) {
opts.GCLookaheadInterval = 2 * time.Hour
opts.GCPurgeInterval = 6 * time.Hour

factory := addressBookFactory(b, badgerStore, opts)
factory := addressBookFactory(b, leveldbStore, opts)
ab, closeFn := factory()
defer closeFn()

Expand Down
9 changes: 5 additions & 4 deletions p2p/host/peerstore/pstoreds/ds_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
type datastoreFactory func(tb testing.TB) (ds.Batching, func())

var dstores = map[string]datastoreFactory{
"Badger": badgerStore,
// "Leveldb": leveldbStore,
//"Badger": badgerStore,
"Leveldb": leveldbStore,
}

func TestDsPeerstore(t *testing.T) {
Expand Down Expand Up @@ -87,6 +87,8 @@ func BenchmarkDsPeerstore(b *testing.B) {
}
}

// Doesn't work on 32bit because badger.
//lint:ignore U1000 disabled for now
func badgerStore(tb testing.TB) (ds.Batching, func()) {
dataPath, err := ioutil.TempDir(os.TempDir(), "badger")
if err != nil {
Expand All @@ -103,8 +105,7 @@ func badgerStore(tb testing.TB) (ds.Batching, func()) {
return store, closer
}

//lint:ignore U1000 disabled for now
func leveldbStore(tb testing.TB) (ds.TxnDatastore, func()) {
func leveldbStore(tb testing.TB) (ds.Batching, func()) {
dataPath, err := ioutil.TempDir(os.TempDir(), "leveldb")
if err != nil {
tb.Fatal(err)
Expand Down
8 changes: 4 additions & 4 deletions p2p/host/peerstore/test/addr_book_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ func testAddAddress(ab pstore.AddrBook) func(*testing.T) {
// 1 second left
ab.AddAddrs(id, addrs, 3*time.Second)
// 3 seconds left
time.Sleep(2 * time.Second)
// 1 seconds left.
time.Sleep(1 * time.Second)
// 2 seconds left.

// We still have the address.
AssertAddressesEqual(t, addrs, ab.Addrs(id))
Expand Down Expand Up @@ -246,7 +246,7 @@ func testUpdateTTLs(m pstore.AddrBook) func(t *testing.T) {
AssertAddressesEqual(t, addrs2, m.Addrs(ids[1]))

// After a wait, addrs[0] is gone.
time.Sleep(1500 * time.Millisecond)
time.Sleep(2 * time.Second)
AssertAddressesEqual(t, addrs1[1:2], m.Addrs(ids[0]))
AssertAddressesEqual(t, addrs2, m.Addrs(ids[1]))

Expand All @@ -257,7 +257,7 @@ func testUpdateTTLs(m pstore.AddrBook) func(t *testing.T) {
AssertAddressesEqual(t, addrs1[1:2], m.Addrs(ids[0]))
AssertAddressesEqual(t, addrs2, m.Addrs(ids[1]))

time.Sleep(1500 * time.Millisecond)
time.Sleep(2 * time.Second)

// First addrs is gone in both.
AssertAddressesEqual(t, addrs1[1:], m.Addrs(ids[0]))
Expand Down

0 comments on commit 27386f6

Please sign in to comment.