Skip to content

Commit

Permalink
add 0 value test
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindiu authored and vankichi committed Nov 18, 2020
1 parent 4c04b55 commit ebc08e9
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions internal/net/http/client/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit ebc08e9

Please sign in to comment.