mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-02-05 06:10:09 +08:00
reenable Badger tests on 64 bit platforms
This commit is contained in:
parent
a66346d0c1
commit
2fed189d2e
@ -4,28 +4,33 @@ import (
|
||||
"context"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"strconv"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
ds "github.com/ipfs/go-datastore"
|
||||
badger "github.com/ipfs/go-ds-badger"
|
||||
leveldb "github.com/ipfs/go-ds-leveldb"
|
||||
|
||||
pstore "github.com/libp2p/go-libp2p-core/peerstore"
|
||||
pt "github.com/libp2p/go-libp2p-peerstore/test"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
type datastoreFactory func(tb testing.TB) (ds.Batching, func())
|
||||
|
||||
var dstores = map[string]datastoreFactory{
|
||||
//"Badger": badgerStore,
|
||||
"Badger": badgerStore,
|
||||
"Leveldb": leveldbStore,
|
||||
}
|
||||
|
||||
func TestDsPeerstore(t *testing.T) {
|
||||
for name, dsFactory := range dstores {
|
||||
if name == "Badger" && strconv.IntSize == 32 {
|
||||
t.Skip("Badger doesn't work on 32 bits")
|
||||
}
|
||||
|
||||
t.Run(name, func(t *testing.T) {
|
||||
pt.TestPeerstore(t, peerstoreFactory(t, dsFactory, DefaultOpts()))
|
||||
})
|
||||
@ -97,8 +102,6 @@ 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 {
|
||||
|
Loading…
Reference in New Issue
Block a user