From d064e8252457eeb44e05069bf50d5919c060c690 Mon Sep 17 00:00:00 2001 From: Dennis Trautwein Date: Wed, 13 Sep 2023 18:40:08 +0200 Subject: [PATCH] use map datastore instead of leveldb --- v2/backend_provider_test.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/v2/backend_provider_test.go b/v2/backend_provider_test.go index e8771f33..e35023d5 100644 --- a/v2/backend_provider_test.go +++ b/v2/backend_provider_test.go @@ -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" @@ -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) @@ -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) @@ -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)