mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 17:33:47 +00:00
swarm/network/stream: Fix TestDeliveryFromNodes
This commit is contained in:
parent
0fb5df8ac2
commit
1f731cd016
2 changed files with 5 additions and 13 deletions
|
|
@ -381,14 +381,13 @@ func testDeliveryFromNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck
|
||||||
for j := 0; j < nodes-1; j++ {
|
for j := 0; j < nodes-1; j++ {
|
||||||
id := sim.IDs[j]
|
id := sim.IDs[j]
|
||||||
err := sim.CallClient(id, func(client *rpc.Client) error {
|
err := sim.CallClient(id, func(client *rpc.Client) error {
|
||||||
err := streamTesting.WatchDisconnections(sim.IDs[j], client, peerCount(sim.IDs[j]), errc, quitC)
|
err := streamTesting.WatchDisconnections(id, client, peerCount(id), errc, quitC)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ctx, cancel := context.WithTimeout(ctx, 1*time.Second)
|
ctx, cancel := context.WithTimeout(ctx, 1*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
j++
|
sid := sim.IDs[j+1]
|
||||||
sid := sim.IDs[j]
|
|
||||||
return client.CallContext(ctx, nil, "stream_subscribeStream", sid, swarmChunkServerStreamName, nil, 0, 0, Top, false)
|
return client.CallContext(ctx, nil, "stream_subscribeStream", sid, swarmChunkServerStreamName, nil, 0, 0, Top, false)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -416,9 +415,7 @@ func testDeliveryFromNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck
|
||||||
}()
|
}()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
checkC := make(chan struct{})
|
|
||||||
check := func(ctx context.Context, id discover.NodeID) (bool, error) {
|
check := func(ctx context.Context, id discover.NodeID) (bool, error) {
|
||||||
defer func() { checkC <- struct{}{} }()
|
|
||||||
select {
|
select {
|
||||||
case err := <-errc:
|
case err := <-errc:
|
||||||
return false, err
|
return false, err
|
||||||
|
|
|
||||||
|
|
@ -37,15 +37,10 @@ import (
|
||||||
const dataChunkCount = 1000
|
const dataChunkCount = 1000
|
||||||
|
|
||||||
func TestSyncerSimulation(t *testing.T) {
|
func TestSyncerSimulation(t *testing.T) {
|
||||||
// testSyncBetweenNodes(t, 2, 1, dataChunkCount, true, 1)
|
testSyncBetweenNodes(t, 2, 1, dataChunkCount, true, 1)
|
||||||
// testSyncBetweenNodes(t, 2, 1, dataChunkCount, false, 1)
|
testSyncBetweenNodes(t, 4, 1, dataChunkCount, true, 1)
|
||||||
// testSyncBetweenNodes(t, 4, 1, dataChunkCount, true, 1)
|
testSyncBetweenNodes(t, 8, 1, dataChunkCount, true, 1)
|
||||||
// // testSyncBetweenNodes(t, 4, 1, dataChunkCount, false, 1)
|
|
||||||
// testSyncBetweenNodes(t, 8, 1, dataChunkCount, true, 1)
|
|
||||||
// // testSyncBetweenNodes(t, 8, 1, dataChunkCount, false, 1)
|
|
||||||
testSyncBetweenNodes(t, 16, 1, dataChunkCount, true, 1)
|
testSyncBetweenNodes(t, 16, 1, dataChunkCount, true, 1)
|
||||||
// testSyncBetweenNodes(t, 32, 1, dataChunkCount, true, 1)
|
|
||||||
// testSyncBetweenNodes(t, 16, 1, dataChunkCount, false, 1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func testSyncBetweenNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck bool, po uint8) {
|
func testSyncBetweenNodes(t *testing.T, nodes, conns, chunkCount int, skipCheck bool, po uint8) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue