diff options
Diffstat (limited to 'swarm/api/http/test_server.go')
-rw-r--r-- | swarm/api/http/test_server.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/swarm/api/http/test_server.go b/swarm/api/http/test_server.go index 97fdf0d8a..a3be01e99 100644 --- a/swarm/api/http/test_server.go +++ b/swarm/api/http/test_server.go @@ -24,8 +24,10 @@ import ( "testing" "github.com/ethereum/go-ethereum/swarm/api" + "github.com/ethereum/go-ethereum/swarm/chunk" "github.com/ethereum/go-ethereum/swarm/storage" "github.com/ethereum/go-ethereum/swarm/storage/feed" + "github.com/ethereum/go-ethereum/swarm/storage/localstore" ) type TestServer interface { @@ -37,17 +39,15 @@ func NewTestSwarmServer(t *testing.T, serverFunc func(*api.API) TestServer, reso if err != nil { t.Fatal(err) } - - storeParams := storage.NewDefaultLocalStoreParams() - storeParams.DbCapacity = 5000000 - storeParams.CacheCapacity = 5000 - storeParams.Init(swarmDir) - localStore, err := storage.NewLocalStore(storeParams, nil) + localStore, err := localstore.New(swarmDir, make([]byte, 32), nil) if err != nil { os.RemoveAll(swarmDir) t.Fatal(err) } - fileStore := storage.NewFileStore(localStore, storage.NewFileStoreParams()) + + tags := chunk.NewTags() + fileStore := storage.NewFileStore(localStore, storage.NewFileStoreParams(), tags) + // Swarm feeds test setup feedsDir, err := ioutil.TempDir("", "swarm-feeds-test") if err != nil { @@ -59,12 +59,13 @@ func NewTestSwarmServer(t *testing.T, serverFunc func(*api.API) TestServer, reso t.Fatal(err) } - swarmApi := api.NewAPI(fileStore, resolver, feeds.Handler, nil) + swarmApi := api.NewAPI(fileStore, resolver, feeds.Handler, nil, tags) apiServer := httptest.NewServer(serverFunc(swarmApi)) tss := &TestSwarmServer{ Server: apiServer, FileStore: fileStore, + Tags: tags, dir: swarmDir, Hasher: storage.MakeHashFunc(storage.DefaultHash)(), cleanup: func() { @@ -84,6 +85,7 @@ type TestSwarmServer struct { *httptest.Server Hasher storage.SwarmHash FileStore *storage.FileStore + Tags *chunk.Tags dir string cleanup func() CurrentTime uint64 |