les: fix and slim the unit tests of les (#20247)
* les: loose restriction of unit tests * les: update unit tests * les, light: slim the unit tests
This commit is contained in:
committed by
Felföldi Zsolt
parent
fc3661f89c
commit
b9bac1f384
@ -193,6 +193,9 @@ func testOdr(t *testing.T, protocol int, expFail uint64, checkCached bool, fn od
|
||||
if clientHead.Number.Uint64() != 4 {
|
||||
t.Fatalf("Failed to sync the chain with server, head: %v", clientHead.Number.Uint64())
|
||||
}
|
||||
// Disable the mechanism that we will wait a few time for request
|
||||
// even there is no suitable peer to send right now.
|
||||
waitForPeers = 0
|
||||
|
||||
test := func(expFail uint64) {
|
||||
// Mark this as a helper to put the failures at the correct lines
|
||||
@ -202,7 +205,9 @@ func testOdr(t *testing.T, protocol int, expFail uint64, checkCached bool, fn od
|
||||
bhash := rawdb.ReadCanonicalHash(server.db, i)
|
||||
b1 := fn(light.NoOdr, server.db, server.handler.server.chainConfig, server.handler.blockchain, nil, bhash)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 200*time.Millisecond)
|
||||
// Set the timeout as 1 second here, ensure there is enough time
|
||||
// for travis to make the action.
|
||||
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
|
||||
b2 := fn(ctx, client.db, client.handler.backend.chainConfig, nil, client.handler.backend.blockchain, bhash)
|
||||
cancel()
|
||||
|
||||
|
Reference in New Issue
Block a user