From 3adee228d674149163258641b12ba9e3afa49dd6 Mon Sep 17 00:00:00 2001 From: taniwa Date: Wed, 17 May 2023 18:58:50 +0900 Subject: [PATCH] add test case Signed-off-by: taniwa --- handler/handler_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/handler/handler_test.go b/handler/handler_test.go index 13dd37d..5401a6e 100644 --- a/handler/handler_test.go +++ b/handler/handler_test.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "fmt" + "math" "net" "net/http" "net/http/httptest" @@ -596,6 +597,18 @@ func Test_updateDialContext(t *testing.T) { }).DialContext, }, }, + { + name: "check if dialContext.timeout is negative, timeout is math.MaxInt64", + args: args{ + cfg: &http.Transport{}, + dialTimeout: -1, + }, + want: &http.Transport{ + DialContext: (&net.Dialer{ + Timeout: math.MaxInt64, + }).DialContext, + }, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {