Skip to content

Commit

Permalink
improved test coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Tero Saarni <tero.saarni@est.tech>
  • Loading branch information
tsaarni committed Feb 14, 2022
1 parent ec030f8 commit 4fcadcf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions internal/contourconfig/contourconfiguration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func TestParseTimeoutPolicy(t *testing.T) {
MaxConnectionDuration: timeout.DefaultSetting(),
DelayedClose: timeout.DefaultSetting(),
ConnectionShutdownGracePeriod: timeout.DefaultSetting(),
ConnectTimeout: time.Duration(0),
},
},
"timeouts not set": {
Expand All @@ -50,6 +51,7 @@ func TestParseTimeoutPolicy(t *testing.T) {
MaxConnectionDuration: timeout.DefaultSetting(),
DelayedClose: timeout.DefaultSetting(),
ConnectionShutdownGracePeriod: timeout.DefaultSetting(),
ConnectTimeout: time.Duration(0),
},
},
"timeouts all set": {
Expand All @@ -60,6 +62,7 @@ func TestParseTimeoutPolicy(t *testing.T) {
MaxConnectionDuration: pointer.String("infinity"),
DelayedCloseTimeout: pointer.String("5s"),
ConnectionShutdownGracePeriod: pointer.String("6s"),
ConnectTimeout: pointer.String("8s"),
},
expected: contourconfig.Timeouts{
Request: timeout.DurationSetting(time.Second),
Expand All @@ -68,6 +71,7 @@ func TestParseTimeoutPolicy(t *testing.T) {
MaxConnectionDuration: timeout.DisabledSetting(),
DelayedClose: timeout.DurationSetting(time.Second * 5),
ConnectionShutdownGracePeriod: timeout.DurationSetting(time.Second * 6),
ConnectTimeout: time.Duration(8 * time.Second),
},
},
"request timeout invalid": {
Expand Down Expand Up @@ -106,6 +110,12 @@ func TestParseTimeoutPolicy(t *testing.T) {
},
errorMsg: "failed to parse connection shutdown grace period",
},
"connect timeout invalid": {
config: &contour_api_v1alpha1.TimeoutParameters{
ConnectTimeout: pointer.String("infinite"),
},
errorMsg: "failed to parse connect timeout",
},
}

for name, tc := range testCases {
Expand Down

0 comments on commit 4fcadcf

Please sign in to comment.