mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
les: add output for weird unit test failure
This commit is contained in:
parent
e9effbd853
commit
522009b9e9
3 changed files with 14 additions and 1 deletions
|
|
@ -188,6 +188,12 @@ func testOdr(t *testing.T, protocol int, expFail uint64, checkCached bool, fn od
|
||||||
|
|
||||||
client.handler.synchronise(client.peer.peer)
|
client.handler.synchronise(client.peer.peer)
|
||||||
|
|
||||||
|
// Ensure the client has synced all necessary data.
|
||||||
|
clientHead := client.handler.backend.blockchain.CurrentHeader()
|
||||||
|
if clientHead.Number.Uint64() != 4 {
|
||||||
|
t.Fatalf("Failed to sync the chain with server, head: %v", clientHead.Number.Uint64())
|
||||||
|
}
|
||||||
|
|
||||||
test := func(expFail uint64) {
|
test := func(expFail uint64) {
|
||||||
// Mark this as a helper to put the failures at the correct lines
|
// Mark this as a helper to put the failures at the correct lines
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
|
||||||
|
|
@ -81,8 +81,15 @@ func testAccess(t *testing.T, protocol int, fn accessTestFn) {
|
||||||
// Assemble the test environment
|
// Assemble the test environment
|
||||||
server, client, tearDown := newClientServerEnv(t, 4, protocol, nil, nil, 0, false, true)
|
server, client, tearDown := newClientServerEnv(t, 4, protocol, nil, nil, 0, false, true)
|
||||||
defer tearDown()
|
defer tearDown()
|
||||||
|
|
||||||
client.handler.synchronise(client.peer.peer)
|
client.handler.synchronise(client.peer.peer)
|
||||||
|
|
||||||
|
// Ensure the client has synced all necessary data.
|
||||||
|
clientHead := client.handler.backend.blockchain.CurrentHeader()
|
||||||
|
if clientHead.Number.Uint64() != 4 {
|
||||||
|
t.Fatalf("Failed to sync the chain with server, head: %v", clientHead.Number.Uint64())
|
||||||
|
}
|
||||||
|
|
||||||
test := func(expFail uint64) {
|
test := func(expFail uint64) {
|
||||||
for i := uint64(0); i <= server.handler.blockchain.CurrentHeader().Number.Uint64(); i++ {
|
for i := uint64(0); i <= server.handler.blockchain.CurrentHeader().Number.Uint64(); i++ {
|
||||||
bhash := rawdb.ReadCanonicalHash(server.db, i)
|
bhash := rawdb.ReadCanonicalHash(server.db, i)
|
||||||
|
|
|
||||||
|
|
@ -517,7 +517,7 @@ func newClientServerEnv(t *testing.T, blocks int, protocol int, callback indexer
|
||||||
if connect {
|
if connect {
|
||||||
cpeer, err1, speer, err2 = newTestPeerPair("peer", protocol, server, client)
|
cpeer, err1, speer, err2 = newTestPeerPair("peer", protocol, server, client)
|
||||||
select {
|
select {
|
||||||
case <-time.After(time.Millisecond * 100):
|
case <-time.After(time.Millisecond * 300):
|
||||||
case err := <-err1:
|
case err := <-err1:
|
||||||
t.Fatalf("peer 1 handshake error: %v", err)
|
t.Fatalf("peer 1 handshake error: %v", err)
|
||||||
case err := <-err2:
|
case err := <-err2:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue