Merge pull request #2504 from jrthrawny/proxy-protocol-timeout-for-passthrough-pr
Add Timeout For TLS Passthrough
This commit is contained in:
commit
fa9823634c
5 changed files with 46 additions and 1 deletions
|
|
@ -19,6 +19,7 @@ package template
|
|||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/kylelemons/godebug/pretty"
|
||||
|
||||
|
|
@ -32,6 +33,22 @@ func TestFilterErrors(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestProxytTimeoutParsing(t *testing.T) {
|
||||
testCases := map[string]struct {
|
||||
input string
|
||||
expect time.Duration // duration in seconds
|
||||
}{
|
||||
"valid duration": {"35s", time.Duration(35) * time.Second},
|
||||
"invalid duration": {"3zxs", time.Duration(5) * time.Second},
|
||||
}
|
||||
for n, tc := range testCases {
|
||||
cfg := ReadConfig(map[string]string{"proxy-protocol-header-timeout": tc.input})
|
||||
if cfg.ProxyProtocolHeaderTimeout.Seconds() != tc.expect.Seconds() {
|
||||
t.Errorf("Testing %v. Expected %v seconds but got %v seconds", n, tc.expect, cfg.ProxyProtocolHeaderTimeout)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMergeConfigMapToStruct(t *testing.T) {
|
||||
conf := map[string]string{
|
||||
"custom-http-errors": "300,400,demo",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue