From 60b2c349d22c88eefd765a27cd88821e36d34379 Mon Sep 17 00:00:00 2001 From: yuhan6665 <1588741+yuhan6665@users.noreply.github.com> Date: Mon, 1 Jul 2024 22:28:50 -0400 Subject: [PATCH] Try to fix infinite conn read in tests --- transport/internet/httpupgrade/httpupgrade_test.go | 2 ++ transport/internet/splithttp/splithttp_test.go | 1 + transport/internet/websocket/ws_test.go | 1 + 3 files changed, 4 insertions(+) diff --git a/transport/internet/httpupgrade/httpupgrade_test.go b/transport/internet/httpupgrade/httpupgrade_test.go index 991c37cb..f94298ca 100644 --- a/transport/internet/httpupgrade/httpupgrade_test.go +++ b/transport/internet/httpupgrade/httpupgrade_test.go @@ -28,6 +28,7 @@ func Test_listenHTTPUpgradeAndDial(t *testing.T) { defer c.Close() var b [1024]byte + c.SetReadDeadline(time.Now().Add(2 * time.Second)) _, err := c.Read(b[:]) if err != nil { return @@ -87,6 +88,7 @@ func Test_listenHTTPUpgradeAndDialWithHeaders(t *testing.T) { defer c.Close() var b [1024]byte + c.SetReadDeadline(time.Now().Add(2 * time.Second)) _, err := c.Read(b[:]) if err != nil { return diff --git a/transport/internet/splithttp/splithttp_test.go b/transport/internet/splithttp/splithttp_test.go index 52ced9a0..7e22c9ad 100644 --- a/transport/internet/splithttp/splithttp_test.go +++ b/transport/internet/splithttp/splithttp_test.go @@ -33,6 +33,7 @@ func Test_listenSHAndDial(t *testing.T) { defer c.Close() var b [1024]byte + c.SetReadDeadline(time.Now().Add(2 * time.Second)) _, err := c.Read(b[:]) if err != nil { return diff --git a/transport/internet/websocket/ws_test.go b/transport/internet/websocket/ws_test.go index 48892ead..637b7f72 100644 --- a/transport/internet/websocket/ws_test.go +++ b/transport/internet/websocket/ws_test.go @@ -28,6 +28,7 @@ func Test_listenWSAndDial(t *testing.T) { defer c.Close() var b [1024]byte + c.SetReadDeadline(time.Now().Add(2 * time.Second)) _, err := c.Read(b[:]) if err != nil { return