swarm/pss: minor refactoring

This commit is contained in:
Vlad 2019-03-18 16:29:18 +04:00
parent a198ac7a08
commit 2de3d0934b

View file

@ -213,13 +213,14 @@ func testProxNetwork(t *testing.T) {
services := newProxServices(tstdata, true, handlerContextFuncs, tstdata.kademlias) services := newProxServices(tstdata, true, handlerContextFuncs, tstdata.kademlias)
tstdata.sim = simulation.New(services) tstdata.sim = simulation.New(services)
defer tstdata.sim.Close() defer tstdata.sim.Close()
err := tstdata.sim.UploadSnapshot(fmt.Sprintf("testdata/snapshot_%d.json", nodeCount)) filename := fmt.Sprintf("testdata/snapshot_%d.json", nodeCount)
err := tstdata.sim.UploadSnapshot(filename)
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
ctx, cancel := context.WithTimeout(context.Background(), time.Second*120) ctx, cancel := context.WithTimeout(context.Background(), time.Second*120)
defer cancel() defer cancel()
snap, err := simulation.ReadSnapshot(fmt.Sprintf("testdata/snapshot_%d.json", nodeCount)) snap, err := simulation.ReadSnapshot(filename)
if err != nil { if err != nil {
t.Fatalf("failed to read snapshot: %s", err) t.Fatalf("failed to read snapshot: %s", err)
} }