github.com/prysmaticlabs/prysm@v1.4.4/beacon-chain/db/kv/kv_test.go (about)

     1  package kv
     2  
     3  import (
     4  	"context"
     5  	"testing"
     6  
     7  	"github.com/prysmaticlabs/prysm/shared/testutil/require"
     8  )
     9  
    10  // setupDB instantiates and returns a Store instance.
    11  func setupDB(t testing.TB) *Store {
    12  	db, err := NewKVStore(context.Background(), t.TempDir(), &Config{})
    13  	require.NoError(t, err, "Failed to instantiate DB")
    14  	t.Cleanup(func() {
    15  		require.NoError(t, db.Close(), "Failed to close database")
    16  	})
    17  	return db
    18  }