Merge pull request #3393 from nspcc-dev/testrpc

rpc: fix TestRPC timeout
This commit is contained in:
Anna Shaleva 2024-04-02 12:37:16 +03:00 committed by GitHub
commit 309016561d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3463,7 +3463,7 @@ func doRPCCallOverWS(rpcCall string, url string, t *testing.T) []byte {
dialer := websocket.Dialer{ dialer := websocket.Dialer{
HandshakeTimeout: 5 * time.Second, HandshakeTimeout: 5 * time.Second,
NetDialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { NetDialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
dialer := net.Dialer{Timeout: 3 * time.Second, dialer := net.Dialer{Timeout: 5 * time.Second,
KeepAlive: 30 * time.Second, KeepAlive: 30 * time.Second,
FallbackDelay: -1} FallbackDelay: -1}
return dialer.DialContext(ctx, "tcp4", addr) return dialer.DialContext(ctx, "tcp4", addr)
@ -3485,13 +3485,13 @@ func doRPCCallOverWS(rpcCall string, url string, t *testing.T) []byte {
} }
func doRPCCallOverHTTP(rpcCall string, url string, t *testing.T) []byte { func doRPCCallOverHTTP(rpcCall string, url string, t *testing.T) []byte {
cl := http.Client{Timeout: 3 * time.Second, Transport: &http.Transport{ cl := http.Client{Timeout: 5 * time.Second, Transport: &http.Transport{
MaxIdleConns: 50, MaxIdleConns: 50,
MaxConnsPerHost: 50, MaxConnsPerHost: 50,
MaxIdleConnsPerHost: 50, MaxIdleConnsPerHost: 50,
IdleConnTimeout: 3 * time.Second, IdleConnTimeout: 5 * time.Second,
DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) { DialContext: func(ctx context.Context, network, addr string) (net.Conn, error) {
dialer := net.Dialer{Timeout: 3 * time.Second, dialer := net.Dialer{Timeout: 5 * time.Second,
KeepAlive: 30 * time.Second, KeepAlive: 30 * time.Second,
FallbackDelay: -1} FallbackDelay: -1}
return dialer.DialContext(ctx, "tcp4", addr) return dialer.DialContext(ctx, "tcp4", addr)