aboutsummaryrefslogtreecommitdiffstats
path: root/swarm
diff options
context:
space:
mode:
Diffstat (limited to 'swarm')
-rw-r--r--swarm/api/client/client_test.go8
-rw-r--r--swarm/api/http/test_server.go35
-rw-r--r--swarm/storage/ldbstore_test.go8
3 files changed, 34 insertions, 17 deletions
diff --git a/swarm/api/client/client_test.go b/swarm/api/client/client_test.go
index 39f6e4797..9c9bde5d6 100644
--- a/swarm/api/client/client_test.go
+++ b/swarm/api/client/client_test.go
@@ -25,6 +25,8 @@ import (
"sort"
"testing"
+ "github.com/ethereum/go-ethereum/swarm/testutil"
+
"github.com/ethereum/go-ethereum/swarm/storage"
"github.com/ethereum/go-ethereum/swarm/storage/feed/lookup"
@@ -43,7 +45,13 @@ func serverFunc(api *api.API) swarmhttp.TestServer {
func TestClientUploadDownloadRaw(t *testing.T) {
testClientUploadDownloadRaw(false, t)
}
+
func TestClientUploadDownloadRawEncrypted(t *testing.T) {
+ if testutil.RaceEnabled {
+ t.Skip("flaky with -race on Travis")
+ // See: https://github.com/ethersphere/go-ethereum/issues/1254
+ }
+
testClientUploadDownloadRaw(true, t)
}
diff --git a/swarm/api/http/test_server.go b/swarm/api/http/test_server.go
index 9245c9c5b..97fdf0d8a 100644
--- a/swarm/api/http/test_server.go
+++ b/swarm/api/http/test_server.go
@@ -33,44 +33,45 @@ type TestServer interface {
}
func NewTestSwarmServer(t *testing.T, serverFunc func(*api.API) TestServer, resolver api.Resolver) *TestSwarmServer {
- dir, err := ioutil.TempDir("", "swarm-storage-test")
+ swarmDir, err := ioutil.TempDir("", "swarm-storage-test")
if err != nil {
t.Fatal(err)
}
- storeparams := storage.NewDefaultLocalStoreParams()
- storeparams.DbCapacity = 5000000
- storeparams.CacheCapacity = 5000
- storeparams.Init(dir)
- localStore, err := storage.NewLocalStore(storeparams, nil)
+
+ storeParams := storage.NewDefaultLocalStoreParams()
+ storeParams.DbCapacity = 5000000
+ storeParams.CacheCapacity = 5000
+ storeParams.Init(swarmDir)
+ localStore, err := storage.NewLocalStore(storeParams, nil)
if err != nil {
- os.RemoveAll(dir)
+ os.RemoveAll(swarmDir)
t.Fatal(err)
}
fileStore := storage.NewFileStore(localStore, storage.NewFileStoreParams())
-
// Swarm feeds test setup
feedsDir, err := ioutil.TempDir("", "swarm-feeds-test")
if err != nil {
t.Fatal(err)
}
- rhparams := &feed.HandlerParams{}
- rh, err := feed.NewTestHandler(feedsDir, rhparams)
+ feeds, err := feed.NewTestHandler(feedsDir, &feed.HandlerParams{})
if err != nil {
t.Fatal(err)
}
- a := api.NewAPI(fileStore, resolver, rh.Handler, nil)
- srv := httptest.NewServer(serverFunc(a))
+ swarmApi := api.NewAPI(fileStore, resolver, feeds.Handler, nil)
+ apiServer := httptest.NewServer(serverFunc(swarmApi))
+
tss := &TestSwarmServer{
- Server: srv,
+ Server: apiServer,
FileStore: fileStore,
- dir: dir,
+ dir: swarmDir,
Hasher: storage.MakeHashFunc(storage.DefaultHash)(),
cleanup: func() {
- srv.Close()
- rh.Close()
- os.RemoveAll(dir)
+ apiServer.Close()
+ fileStore.Close()
+ feeds.Close()
+ os.RemoveAll(swarmDir)
os.RemoveAll(feedsDir)
},
CurrentTime: 42,
diff --git a/swarm/storage/ldbstore_test.go b/swarm/storage/ldbstore_test.go
index d17bd7d0e..70b0d6bb4 100644
--- a/swarm/storage/ldbstore_test.go
+++ b/swarm/storage/ldbstore_test.go
@@ -27,6 +27,8 @@ import (
"strings"
"testing"
+ "github.com/ethereum/go-ethereum/swarm/testutil"
+
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/swarm/chunk"
"github.com/ethereum/go-ethereum/swarm/log"
@@ -322,6 +324,12 @@ func TestLDBStoreCollectGarbage(t *testing.T) {
initialCap := defaultMaxGCRound / 100
cap := initialCap / 2
t.Run(fmt.Sprintf("A/%d/%d", cap, cap*4), testLDBStoreCollectGarbage)
+
+ if testutil.RaceEnabled {
+ t.Skip("only the simplest case run as others are flaky with race")
+ // Note: some tests fail consistently and even locally with `-race`
+ }
+
t.Run(fmt.Sprintf("B/%d/%d", cap, cap*4), testLDBStoreRemoveThenCollectGarbage)
// at max round