aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2018-11-19 19:26:45 +0800
committerGitHub <noreply@github.com>2018-11-19 19:26:45 +0800
commit3333fe660f00b519a9d16398ca3801ab9313be16 (patch)
tree3dae08a2219830a389bb8fe0a3277c8b3b1b4c38
parent51e2e78d26b9e8c7b6297cf51662cf22debbb7c6 (diff)
downloaddexon-3333fe660f00b519a9d16398ca3801ab9313be16.tar.gz
dexon-3333fe660f00b519a9d16398ca3801ab9313be16.tar.zst
dexon-3333fe660f00b519a9d16398ca3801ab9313be16.zip
swarm/storage: speed up garbage collection and rpc tests (#18128)
-rw-r--r--swarm/storage/ldbstore_test.go9
-rw-r--r--swarm/storage/mock/rpc/rpc_test.go2
2 files changed, 6 insertions, 5 deletions
diff --git a/swarm/storage/ldbstore_test.go b/swarm/storage/ldbstore_test.go
index 9c10b3629..e8b9ae39b 100644
--- a/swarm/storage/ldbstore_test.go
+++ b/swarm/storage/ldbstore_test.go
@@ -344,17 +344,18 @@ func TestLDBStoreWithoutCollectGarbage(t *testing.T) {
func TestLDBStoreCollectGarbage(t *testing.T) {
// below max ronud
- cap := defaultMaxGCRound / 2
+ initialCap := defaultMaxGCRound / 100
+ cap := initialCap / 2
t.Run(fmt.Sprintf("A/%d/%d", cap, cap*4), testLDBStoreCollectGarbage)
t.Run(fmt.Sprintf("B/%d/%d", cap, cap*4), testLDBStoreRemoveThenCollectGarbage)
// at max round
- cap = defaultMaxGCRound
+ cap = initialCap
t.Run(fmt.Sprintf("A/%d/%d", cap, cap*4), testLDBStoreCollectGarbage)
t.Run(fmt.Sprintf("B/%d/%d", cap, cap*4), testLDBStoreRemoveThenCollectGarbage)
// more than max around, not on threshold
- cap = defaultMaxGCRound * 1.1
+ cap = initialCap + 500
t.Run(fmt.Sprintf("A/%d/%d", cap, cap*4), testLDBStoreCollectGarbage)
t.Run(fmt.Sprintf("B/%d/%d", cap, cap*4), testLDBStoreRemoveThenCollectGarbage)
@@ -578,7 +579,7 @@ func testLDBStoreRemoveThenCollectGarbage(t *testing.T) {
// TestLDBStoreCollectGarbageAccessUnlikeIndex tests garbage collection where accesscount differs from indexcount
func TestLDBStoreCollectGarbageAccessUnlikeIndex(t *testing.T) {
- capacity := defaultMaxGCRound * 2
+ capacity := defaultMaxGCRound / 100 * 2
n := capacity - 1
ldb, cleanup := newLDBStore(t)
diff --git a/swarm/storage/mock/rpc/rpc_test.go b/swarm/storage/mock/rpc/rpc_test.go
index 52b634a44..f62340ede 100644
--- a/swarm/storage/mock/rpc/rpc_test.go
+++ b/swarm/storage/mock/rpc/rpc_test.go
@@ -37,5 +37,5 @@ func TestRPCStore(t *testing.T) {
store := NewGlobalStore(rpc.DialInProc(server))
defer store.Close()
- test.MockStore(t, store, 100)
+ test.MockStore(t, store, 30)
}