This commit is contained in:
Aarsh Shah 2022-01-20 16:47:15 +04:00
parent b8bf2af3e3
commit 7508d96327
2 changed files with 8 additions and 3 deletions

View File

@ -5,6 +5,8 @@ import (
"io" "io"
"testing" "testing"
mocknet "github.com/libp2p/go-libp2p/p2p/net/mock"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/filecoin-project/dagstore" "github.com/filecoin-project/dagstore"
@ -96,8 +98,11 @@ func TestShardRegistration(t *testing.T) {
cfg := config.DefaultStorageMiner().DAGStore cfg := config.DefaultStorageMiner().DAGStore
cfg.RootDir = t.TempDir() cfg.RootDir = t.TempDir()
h, err := mocknet.New().GenPeer()
require.NoError(t, err)
mapi := NewMinerAPI(ps, &wrappedSA{sa}, 10, 5) mapi := NewMinerAPI(ps, &wrappedSA{sa}, 10, 5)
dagst, w, err := NewDAGStore(cfg, mapi) dagst, w, err := NewDAGStore(cfg, mapi, h)
require.NoError(t, err) require.NoError(t, err)
require.NotNil(t, dagst) require.NotNil(t, dagst)
require.NotNil(t, w) require.NotNil(t, w)

View File

@ -31,7 +31,7 @@ func TestWrapperAcquireRecovery(t *testing.T) {
pieceCid, err := cid.Parse("bafkqaaa") pieceCid, err := cid.Parse("bafkqaaa")
require.NoError(t, err) require.NoError(t, err)
h, err := mocknet.New(ctx).GenPeer() h, err := mocknet.New().GenPeer()
require.NoError(t, err) require.NoError(t, err)
// Create a DAG store wrapper // Create a DAG store wrapper
dagst, w, err := NewDAGStore(config.DAGStoreConfig{ dagst, w, err := NewDAGStore(config.DAGStoreConfig{
@ -83,7 +83,7 @@ func TestWrapperAcquireRecovery(t *testing.T) {
// TestWrapperBackground verifies the behaviour of the background go routine // TestWrapperBackground verifies the behaviour of the background go routine
func TestWrapperBackground(t *testing.T) { func TestWrapperBackground(t *testing.T) {
ctx := context.Background() ctx := context.Background()
h, err := mocknet.New(ctx).GenPeer() h, err := mocknet.New().GenPeer()
require.NoError(t, err) require.NoError(t, err)
// Create a DAG store wrapper // Create a DAG store wrapper