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"
|
"context"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
|
"strconv"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
|
|
||||||
ds "github.com/ipfs/go-datastore"
|
ds "github.com/ipfs/go-datastore"
|
||||||
badger "github.com/ipfs/go-ds-badger"
|
badger "github.com/ipfs/go-ds-badger"
|
||||||
leveldb "github.com/ipfs/go-ds-leveldb"
|
leveldb "github.com/ipfs/go-ds-leveldb"
|
||||||
|
|
||||||
pstore "github.com/libp2p/go-libp2p-core/peerstore"
|
pstore "github.com/libp2p/go-libp2p-core/peerstore"
|
||||||
pt "github.com/libp2p/go-libp2p-peerstore/test"
|
pt "github.com/libp2p/go-libp2p-peerstore/test"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
type datastoreFactory func(tb testing.TB) (ds.Batching, func())
|
type datastoreFactory func(tb testing.TB) (ds.Batching, func())
|
||||||
|
|
||||||
var dstores = map[string]datastoreFactory{
|
var dstores = map[string]datastoreFactory{
|
||||||
//"Badger": badgerStore,
|
"Badger": badgerStore,
|
||||||
"Leveldb": leveldbStore,
|
"Leveldb": leveldbStore,
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDsPeerstore(t *testing.T) {
|
func TestDsPeerstore(t *testing.T) {
|
||||||
for name, dsFactory := range dstores {
|
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) {
|
t.Run(name, func(t *testing.T) {
|
||||||
pt.TestPeerstore(t, peerstoreFactory(t, dsFactory, DefaultOpts()))
|
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()) {
|
func badgerStore(tb testing.TB) (ds.Batching, func()) {
|
||||||
dataPath, err := ioutil.TempDir(os.TempDir(), "badger")
|
dataPath, err := ioutil.TempDir(os.TempDir(), "badger")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user