swarm/network/stream: use swarm/mock/mem as mock global store (#18157)
This commit is contained in:
committed by
Anton Evangelatov
parent
4c181e4fb9
commit
070caec4bd
@ -35,7 +35,8 @@ import (
|
||||
"github.com/ethereum/go-ethereum/swarm/pot"
|
||||
"github.com/ethereum/go-ethereum/swarm/state"
|
||||
"github.com/ethereum/go-ethereum/swarm/storage"
|
||||
mockdb "github.com/ethereum/go-ethereum/swarm/storage/mock/db"
|
||||
"github.com/ethereum/go-ethereum/swarm/storage/mock"
|
||||
mockmem "github.com/ethereum/go-ethereum/swarm/storage/mock/mem"
|
||||
"github.com/ethereum/go-ethereum/swarm/testutil"
|
||||
)
|
||||
|
||||
@ -268,20 +269,9 @@ func runSim(conf *synctestConfig, ctx context.Context, sim *simulation.Simulatio
|
||||
|
||||
// File retrieval check is repeated until all uploaded files are retrieved from all nodes
|
||||
// or until the timeout is reached.
|
||||
var gDir string
|
||||
var globalStore *mockdb.GlobalStore
|
||||
var globalStore mock.GlobalStorer
|
||||
if *useMockStore {
|
||||
gDir, globalStore, err = createGlobalStore()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Something went wrong; using mockStore enabled but globalStore is nil")
|
||||
}
|
||||
defer func() {
|
||||
os.RemoveAll(gDir)
|
||||
err := globalStore.Close()
|
||||
if err != nil {
|
||||
log.Error("Error closing global store! %v", "err", err)
|
||||
}
|
||||
}()
|
||||
globalStore = mockmem.NewGlobalStore()
|
||||
}
|
||||
REPEAT:
|
||||
for {
|
||||
@ -476,14 +466,9 @@ func testSyncingViaDirectSubscribe(t *testing.T, chunkCount int, nodeCount int)
|
||||
return err
|
||||
}
|
||||
|
||||
var gDir string
|
||||
var globalStore *mockdb.GlobalStore
|
||||
var globalStore mock.GlobalStorer
|
||||
if *useMockStore {
|
||||
gDir, globalStore, err = createGlobalStore()
|
||||
if err != nil {
|
||||
return fmt.Errorf("Something went wrong; using mockStore enabled but globalStore is nil")
|
||||
}
|
||||
defer os.RemoveAll(gDir)
|
||||
globalStore = mockmem.NewGlobalStore()
|
||||
}
|
||||
// File retrieval check is repeated until all uploaded files are retrieved from all nodes
|
||||
// or until the timeout is reached.
|
||||
|
Reference in New Issue
Block a user