mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/pss: Shorten TextProxNetwork shortrunning test timeout
This commit is contained in:
parent
d5f3393a7b
commit
e3a6125f65
1 changed files with 15 additions and 10 deletions
|
|
@ -93,7 +93,7 @@ func (d *testData) setDone() {
|
||||||
d.handlerDone = true
|
d.handlerDone = true
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCmdParams(t *testing.T) (int, int) {
|
func getCmdParams(t *testing.T) (int, int, time.Duration) {
|
||||||
args := strings.Split(t.Name(), "/")
|
args := strings.Split(t.Name(), "/")
|
||||||
msgCount, err := strconv.ParseInt(args[2], 10, 16)
|
msgCount, err := strconv.ParseInt(args[2], 10, 16)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -103,7 +103,12 @@ func getCmdParams(t *testing.T) (int, int) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
return int(msgCount), int(nodeCount)
|
timeoutStr := fmt.Sprintf("%ss", args[3])
|
||||||
|
timeoutDur, err := time.ParseDuration(timeoutStr)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
return int(msgCount), int(nodeCount), timeoutDur
|
||||||
}
|
}
|
||||||
|
|
||||||
func readSnapshot(t *testing.T, nodeCount int) simulations.Snapshot {
|
func readSnapshot(t *testing.T, nodeCount int) simulations.Snapshot {
|
||||||
|
|
@ -222,7 +227,7 @@ func (d *testData) init(msgCount int) error {
|
||||||
// nodes Y and Z will be considered required recipients of the msg,
|
// nodes Y and Z will be considered required recipients of the msg,
|
||||||
// whereas nodes X, Y and Z will be allowed recipients.
|
// whereas nodes X, Y and Z will be allowed recipients.
|
||||||
func TestProxNetwork(t *testing.T) {
|
func TestProxNetwork(t *testing.T) {
|
||||||
t.Run("16/16", testProxNetwork)
|
t.Run("16/16/10", testProxNetwork)
|
||||||
}
|
}
|
||||||
|
|
||||||
// params in run name: nodes/msgs
|
// params in run name: nodes/msgs
|
||||||
|
|
@ -230,16 +235,16 @@ func TestProxNetworkLong(t *testing.T) {
|
||||||
if !*longrunning {
|
if !*longrunning {
|
||||||
t.Skip("run with --longrunning flag to run extensive network tests")
|
t.Skip("run with --longrunning flag to run extensive network tests")
|
||||||
}
|
}
|
||||||
t.Run("8/100", testProxNetwork)
|
t.Run("8/100/30", testProxNetwork)
|
||||||
t.Run("16/100", testProxNetwork)
|
t.Run("16/100/30", testProxNetwork)
|
||||||
t.Run("32/100", testProxNetwork)
|
t.Run("32/100/60", testProxNetwork)
|
||||||
t.Run("64/100", testProxNetwork)
|
t.Run("64/100/60", testProxNetwork)
|
||||||
t.Run("128/100", testProxNetwork)
|
t.Run("128/100/120", testProxNetwork)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testProxNetwork(t *testing.T) {
|
func testProxNetwork(t *testing.T) {
|
||||||
tstdata := newTestData()
|
tstdata := newTestData()
|
||||||
msgCount, nodeCount := getCmdParams(t)
|
msgCount, nodeCount, timeout := getCmdParams(t)
|
||||||
handlerContextFuncs := make(map[Topic]handlerContextFunc)
|
handlerContextFuncs := make(map[Topic]handlerContextFunc)
|
||||||
handlerContextFuncs[topic] = nodeMsgHandler
|
handlerContextFuncs[topic] = nodeMsgHandler
|
||||||
services := newProxServices(tstdata, true, handlerContextFuncs, tstdata.kademlias)
|
services := newProxServices(tstdata, true, handlerContextFuncs, tstdata.kademlias)
|
||||||
|
|
@ -249,7 +254,7 @@ func testProxNetwork(t *testing.T) {
|
||||||
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(), timeout)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
snap := readSnapshot(t, nodeCount)
|
snap := readSnapshot(t, nodeCount)
|
||||||
err = tstdata.sim.WaitTillSnapshotRecreated(ctx, snap)
|
err = tstdata.sim.WaitTillSnapshotRecreated(ctx, snap)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue