Skip to content

Commit

Permalink
use map datastore instead of leveldb
Browse files Browse the repository at this point in the history
  • Loading branch information
dennis-tra committed Sep 13, 2023
1 parent 0e32765 commit d064e82
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions v2/backend_provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/benbjohnson/clock"
ds "github.com/ipfs/go-datastore"
syncds "github.com/ipfs/go-datastore/sync"
"github.com/libp2p/go-libp2p"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand All @@ -21,9 +22,7 @@ func newBackendProvider(t testing.TB, cfg *ProvidersBackendConfig) *ProvidersBac
h, err := libp2p.New(libp2p.NoListenAddrs)
require.NoError(t, err)

dstore, err := InMemoryDatastore()
require.NoError(t, err)

dstore := syncds.MutexWrap(ds.NewMapDatastore())
t.Cleanup(func() {
if err = dstore.Close(); err != nil {
t.Logf("closing datastore: %s", err)
Expand All @@ -47,7 +46,7 @@ func TestProvidersBackend_GarbageCollection(t *testing.T) {
require.NoError(t, err)

cfg.clk = clk
// cfg.Logger = devnull
cfg.Logger = devnull

b := newBackendProvider(t, cfg)

Expand Down Expand Up @@ -86,8 +85,6 @@ func TestProvidersBackend_GarbageCollection(t *testing.T) {
err = b.datastore.Sync(ctx, ds.NewKey("/"))
require.NoError(t, err)

clk.Add(time.Minute)

// we expect the record to be GC'd now
val, err := b.datastore.Get(ctx, dsKey)
assert.ErrorIs(t, err, ds.ErrNotFound)
Expand Down

0 comments on commit d064e82

Please sign in to comment.