-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #286 from buildkite/feat_add_max_idle_connections
This change enables configuration of http connection pooling
- Loading branch information
Showing
5 changed files
with
106 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package main | ||
|
||
import "testing" | ||
|
||
func Test_toIntWithDefault(t *testing.T) { | ||
type args struct { | ||
val string | ||
defaultVal int | ||
} | ||
tests := []struct { | ||
name string | ||
args args | ||
want int | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "empty", | ||
args: args{val: "", defaultVal: 10}, | ||
want: 10, | ||
}, | ||
{ | ||
name: "invalid", | ||
args: args{val: "invalid", defaultVal: 10}, | ||
wantErr: true, | ||
}, | ||
{ | ||
name: "valid", | ||
args: args{val: "20", defaultVal: 10}, | ||
want: 20, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
got, err := toIntWithDefault(tt.args.val, tt.args.defaultVal) | ||
if (err != nil) != tt.wantErr { | ||
t.Errorf("toIntWithDefault(%q, %d) error = %v, wantErr %v", tt.args.val, tt.args.defaultVal, err, tt.wantErr) | ||
return | ||
} | ||
if got != tt.want { | ||
t.Errorf("toIntWithDefault(%q, %d) = %v, want %v", tt.args.val, tt.args.defaultVal, got, tt.want) | ||
} | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters