mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
swarm/network: fixed longrunning tests
This commit is contained in:
parent
211255aed7
commit
6d15944543
4 changed files with 16 additions and 15 deletions
|
|
@ -840,7 +840,8 @@ func (net *Network) snapshot(addServices []string, removeServices []string) (*Sn
|
||||||
return snap, nil
|
return snap, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var snapshotLoadTimeout = 6000 * time.Second
|
// longrunning tests may need a longer timeout
|
||||||
|
var snapshotLoadTimeout = 7200 * time.Second
|
||||||
|
|
||||||
// Load loads a network snapshot
|
// Load loads a network snapshot
|
||||||
func (net *Network) Load(snap *Snapshot) error {
|
func (net *Network) Load(snap *Snapshot) error {
|
||||||
|
|
|
||||||
|
|
@ -53,8 +53,7 @@ func TestFileRetrieval(t *testing.T) {
|
||||||
nodeCount = []int{16}
|
nodeCount = []int{16}
|
||||||
|
|
||||||
if *longrunning {
|
if *longrunning {
|
||||||
//nodeCount = append(nodeCount, 32, 64, 128)
|
nodeCount = append(nodeCount, 32, 64, 128)
|
||||||
nodeCount = append(nodeCount, 48)
|
|
||||||
} else if testutil.RaceEnabled {
|
} else if testutil.RaceEnabled {
|
||||||
nodeCount = []int{4}
|
nodeCount = []int{4}
|
||||||
}
|
}
|
||||||
|
|
@ -87,10 +86,8 @@ func TestRetrieval(t *testing.T) {
|
||||||
chnkCnt := []int{32}
|
chnkCnt := []int{32}
|
||||||
|
|
||||||
if *longrunning {
|
if *longrunning {
|
||||||
//nodeCnt = []int{16, 32, 128}
|
nodeCnt = []int{16, 32, 128}
|
||||||
nodeCnt = []int{32, 48}
|
chnkCnt = []int{4, 32, 256}
|
||||||
chnkCnt = []int{64, 128}
|
|
||||||
//chnkCnt = []int{4, 32, 256}
|
|
||||||
} else if testutil.RaceEnabled {
|
} else if testutil.RaceEnabled {
|
||||||
nodeCnt = []int{4}
|
nodeCnt = []int{4}
|
||||||
chnkCnt = []int{4}
|
chnkCnt = []int{4}
|
||||||
|
|
|
||||||
|
|
@ -95,8 +95,7 @@ func TestSyncingViaGlobalSync(t *testing.T) {
|
||||||
//run more test combinations
|
//run more test combinations
|
||||||
if *longrunning {
|
if *longrunning {
|
||||||
chunkCounts = []int{64, 128}
|
chunkCounts = []int{64, 128}
|
||||||
//nodeCounts = []int{16, 32, 64, 128, 256}
|
nodeCounts = []int{64, 128}
|
||||||
nodeCounts = []int{32, 48}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, chunkCount := range chunkCounts {
|
for _, chunkCount := range chunkCounts {
|
||||||
|
|
|
||||||
|
|
@ -1188,12 +1188,13 @@ func TestGetSubscriptionsRPC(t *testing.T) {
|
||||||
|
|
||||||
// arbitrarily set to 4
|
// arbitrarily set to 4
|
||||||
nodeCount := 4
|
nodeCount := 4
|
||||||
|
// set the syncUpdateDelay for sync registrations to start
|
||||||
|
syncUpdateDelay := 200 * time.Millisecond
|
||||||
// run with more nodes if `longrunning` flag is set
|
// run with more nodes if `longrunning` flag is set
|
||||||
if *longrunning {
|
if *longrunning {
|
||||||
nodeCount = 64
|
nodeCount = 64
|
||||||
|
syncUpdateDelay = 10 * time.Second
|
||||||
}
|
}
|
||||||
// set the syncUpdateDelay for sync registrations to start
|
|
||||||
syncUpdateDelay := 200 * time.Millisecond
|
|
||||||
// holds the msg code for SubscribeMsg
|
// holds the msg code for SubscribeMsg
|
||||||
var subscribeMsgCode uint64
|
var subscribeMsgCode uint64
|
||||||
var ok bool
|
var ok bool
|
||||||
|
|
@ -1241,7 +1242,7 @@ func TestGetSubscriptionsRPC(t *testing.T) {
|
||||||
})
|
})
|
||||||
defer sim.Close()
|
defer sim.Close()
|
||||||
|
|
||||||
ctx, cancelSimRun := context.WithTimeout(context.Background(), 1*time.Minute)
|
ctx, cancelSimRun := context.WithTimeout(context.Background(), 3*time.Minute)
|
||||||
defer cancelSimRun()
|
defer cancelSimRun()
|
||||||
|
|
||||||
// upload a snapshot
|
// upload a snapshot
|
||||||
|
|
@ -1267,6 +1268,9 @@ func TestGetSubscriptionsRPC(t *testing.T) {
|
||||||
go func() {
|
go func() {
|
||||||
//for long running sims, waiting 1 sec will not be enough
|
//for long running sims, waiting 1 sec will not be enough
|
||||||
waitDuration := time.Duration(nodeCount/16) * time.Second
|
waitDuration := time.Duration(nodeCount/16) * time.Second
|
||||||
|
if *longrunning {
|
||||||
|
waitDuration = syncUpdateDelay
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
|
@ -1328,11 +1332,11 @@ func TestGetSubscriptionsRPC(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.Debug("All node streams counted", "realCount", realCount)
|
||||||
}
|
}
|
||||||
// every node is mutually subscribed to each other, so the actual count is half of it
|
|
||||||
emc := expectedMsgCount.count()
|
emc := expectedMsgCount.count()
|
||||||
if realCount/2 != emc {
|
if realCount != emc {
|
||||||
return fmt.Errorf("Real subscriptions and expected amount don't match; real: %d, expected: %d", realCount/2, emc)
|
return fmt.Errorf("Real subscriptions and expected amount don't match; real: %d, expected: %d", realCount, emc)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue