From ebc08e939f26b6a4bd4fd9f4ce1a190d84424c7a Mon Sep 17 00:00:00 2001 From: kevindiu Date: Mon, 16 Nov 2020 13:51:35 +0900 Subject: [PATCH] add 0 value test --- internal/net/http/client/option_test.go | 78 +++++++++++++++++++++++++ 1 file changed, 78 insertions(+) diff --git a/internal/net/http/client/option_test.go b/internal/net/http/client/option_test.go index bd7e329c53..eb4ce516e2 100644 --- a/internal/net/http/client/option_test.go +++ b/internal/net/http/client/option_test.go @@ -494,6 +494,19 @@ func TestWithMaxIdleConns(t *testing.T) { }, }, }, + { + name: "set conn success with 0 value", + args: args{ + cn: 0, + }, + want: want{ + obj: &T{ + Transport: &http.Transport{ + MaxIdleConns: 0, + }, + }, + }, + }, } for _, test := range tests { @@ -562,6 +575,19 @@ func TestWithMaxIdleConnsPerHost(t *testing.T) { }, }, }, + { + name: "set conn per host success with 0 value", + args: args{ + cn: 0, + }, + want: want{ + obj: &T{ + Transport: &http.Transport{ + MaxIdleConnsPerHost: 0, + }, + }, + }, + }, } for _, test := range tests { @@ -629,6 +655,19 @@ func TestWithMaxConnsPerHost(t *testing.T) { }, }, }, + { + name: "set conn per host success with 0 value", + args: args{ + cn: 0, + }, + want: want{ + obj: &T{ + Transport: &http.Transport{ + MaxConnsPerHost: 0, + }, + }, + }, + }, } for _, test := range tests { @@ -1057,6 +1096,19 @@ func TestWithMaxResponseHeaderBytes(t *testing.T) { }, }, }, + { + name: "set max response header byte with 0 value", + args: args{ + bs: 0, + }, + want: want{ + obj: &T{ + Transport: &http.Transport{ + MaxResponseHeaderBytes: 0, + }, + }, + }, + }, } for _, test := range tests { @@ -1125,6 +1177,19 @@ func TestWithWriteBufferSize(t *testing.T) { }, }, }, + { + name: "set write buffer size with 0 value", + args: args{ + bs: 0, + }, + want: want{ + obj: &T{ + Transport: &http.Transport{ + WriteBufferSize: 0, + }, + }, + }, + }, } for _, test := range tests { @@ -1193,6 +1258,19 @@ func TestWithReadBufferSize(t *testing.T) { }, }, }, + { + name: "set buffer size success with 0 value", + args: args{ + bs: 0, + }, + want: want{ + obj: &T{ + Transport: &http.Transport{ + ReadBufferSize: 0, + }, + }, + }, + }, } for _, test := range tests {