mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
move TestUDPv5_callResend to integration suite (#7845)
This commit is contained in:
parent
4f308148ed
commit
4adb7fd737
@ -13,6 +13,47 @@ import (
|
||||
"github.com/ledgerwatch/log/v3"
|
||||
)
|
||||
|
||||
// This test checks that pending calls are re-sent when a handshake happens.
|
||||
func TestUDPv5_callResend(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("fix me on win please")
|
||||
}
|
||||
t.Parallel()
|
||||
logger := log.New()
|
||||
test := newUDPV5Test(t, logger)
|
||||
t.Cleanup(test.close)
|
||||
|
||||
remote := test.getNode(test.remotekey, test.remoteaddr, logger).Node()
|
||||
done := make(chan error, 2)
|
||||
go func() {
|
||||
_, err := test.udp.ping(remote)
|
||||
done <- err
|
||||
}()
|
||||
go func() {
|
||||
_, err := test.udp.ping(remote)
|
||||
done <- err
|
||||
}()
|
||||
|
||||
// Ping answered by WHOAREYOU.
|
||||
test.waitPacketOut(func(p *v5wire.Ping, addr *net.UDPAddr, nonce v5wire.Nonce) {
|
||||
test.packetIn(&v5wire.Whoareyou{Nonce: nonce}, logger)
|
||||
})
|
||||
// Ping should be re-sent.
|
||||
test.waitPacketOut(func(p *v5wire.Ping, addr *net.UDPAddr, _ v5wire.Nonce) {
|
||||
test.packetIn(&v5wire.Pong{ReqID: p.ReqID}, logger)
|
||||
})
|
||||
// Answer the other ping.
|
||||
test.waitPacketOut(func(p *v5wire.Ping, addr *net.UDPAddr, _ v5wire.Nonce) {
|
||||
test.packetIn(&v5wire.Pong{ReqID: p.ReqID}, logger)
|
||||
})
|
||||
if err := <-done; err != nil {
|
||||
t.Fatalf("unexpected ping error: %v", err)
|
||||
}
|
||||
if err := <-done; err != nil {
|
||||
t.Fatalf("unexpected ping error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// This test checks that calls with n replies may take up to n * respTimeout.
|
||||
func TestUDPv5_callTimeoutReset(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
|
@ -326,47 +326,6 @@ func TestUDPv5_findnodeCall(t *testing.T) {
|
||||
// TODO: check invalid/unsigned record
|
||||
}
|
||||
|
||||
// This test checks that pending calls are re-sent when a handshake happens.
|
||||
func TestUDPv5_callResend(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
t.Skip("fix me on win please")
|
||||
}
|
||||
t.Parallel()
|
||||
logger := log.New()
|
||||
test := newUDPV5Test(t, logger)
|
||||
t.Cleanup(test.close)
|
||||
|
||||
remote := test.getNode(test.remotekey, test.remoteaddr, logger).Node()
|
||||
done := make(chan error, 2)
|
||||
go func() {
|
||||
_, err := test.udp.ping(remote)
|
||||
done <- err
|
||||
}()
|
||||
go func() {
|
||||
_, err := test.udp.ping(remote)
|
||||
done <- err
|
||||
}()
|
||||
|
||||
// Ping answered by WHOAREYOU.
|
||||
test.waitPacketOut(func(p *v5wire.Ping, addr *net.UDPAddr, nonce v5wire.Nonce) {
|
||||
test.packetIn(&v5wire.Whoareyou{Nonce: nonce}, logger)
|
||||
})
|
||||
// Ping should be re-sent.
|
||||
test.waitPacketOut(func(p *v5wire.Ping, addr *net.UDPAddr, _ v5wire.Nonce) {
|
||||
test.packetIn(&v5wire.Pong{ReqID: p.ReqID}, logger)
|
||||
})
|
||||
// Answer the other ping.
|
||||
test.waitPacketOut(func(p *v5wire.Ping, addr *net.UDPAddr, _ v5wire.Nonce) {
|
||||
test.packetIn(&v5wire.Pong{ReqID: p.ReqID}, logger)
|
||||
})
|
||||
if err := <-done; err != nil {
|
||||
t.Fatalf("unexpected ping error: %v", err)
|
||||
}
|
||||
if err := <-done; err != nil {
|
||||
t.Fatalf("unexpected ping error: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// This test ensures we don't allow multiple rounds of WHOAREYOU for a single call.
|
||||
func TestUDPv5_multipleHandshakeRounds(t *testing.T) {
|
||||
if runtime.GOOS == "windows" {
|
||||
|
Loading…
Reference in New Issue
Block a user