aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/storage/mru/testutil.go
diff options
context:
space:
mode:
Diffstat (limited to 'swarm/storage/mru/testutil.go')
-rw-r--r--swarm/storage/mru/testutil.go21
1 files changed, 20 insertions, 1 deletions
diff --git a/swarm/storage/mru/testutil.go b/swarm/storage/mru/testutil.go
index 6efcba9ab..a30baaa1d 100644
--- a/swarm/storage/mru/testutil.go
+++ b/swarm/storage/mru/testutil.go
@@ -17,8 +17,12 @@
package mru
import (
+ "context"
"fmt"
"path/filepath"
+ "sync"
+
+ "github.com/ethereum/go-ethereum/p2p/discover"
"github.com/ethereum/go-ethereum/swarm/storage"
)
@@ -35,6 +39,17 @@ func (t *TestHandler) Close() {
t.chunkStore.Close()
}
+type mockNetFetcher struct{}
+
+func (m *mockNetFetcher) Request(ctx context.Context) {
+}
+func (m *mockNetFetcher) Offer(ctx context.Context, source *discover.NodeID) {
+}
+
+func newFakeNetFetcher(context.Context, storage.Address, *sync.Map) storage.NetFetcher {
+ return &mockNetFetcher{}
+}
+
// NewTestHandler creates Handler object to be used for testing purposes.
func NewTestHandler(datadir string, params *HandlerParams) (*TestHandler, error) {
path := filepath.Join(datadir, testDbDirName)
@@ -47,7 +62,11 @@ func NewTestHandler(datadir string, params *HandlerParams) (*TestHandler, error)
}
localStore.Validators = append(localStore.Validators, storage.NewContentAddressValidator(storage.MakeHashFunc(resourceHashAlgorithm)))
localStore.Validators = append(localStore.Validators, rh)
- netStore := storage.NewNetStore(localStore, nil)
+ netStore, err := storage.NewNetStore(localStore, nil)
+ if err != nil {
+ return nil, err
+ }
+ netStore.NewNetFetcherFunc = newFakeNetFetcher
rh.SetStore(netStore)
return &TestHandler{rh}, nil
}