chore: update k8s.io/client-go for security reason, go is upgrade to 1.16 (#1912)

* chore: fix jwt dependency security issue

* chore: update clickhouse driver

* chore: fix a security issue

* chore: update dependencies
This commit is contained in:
Kevin Wan
2022-05-21 14:34:01 +08:00
committed by GitHub
parent 6f86e5bff8
commit 6b1e15cab1
7 changed files with 134 additions and 77 deletions

View File

@@ -298,6 +298,37 @@ func TestEngine_notFoundHandlerNotNilWriteHeader(t *testing.T) {
assert.Equal(t, int32(1), atomic.LoadInt32(&called))
}
func TestEngine_withTimeout(t *testing.T) {
logx.Disable()
tests := []struct {
name string
timeout int64
}{
{
name: "not set",
},
{
name: "set",
timeout: 1000,
},
}
for _, test := range tests {
test := test
t.Run(test.name, func(t *testing.T) {
ng := newEngine(RestConf{Timeout: test.timeout})
svr := &http.Server{}
ng.withTimeout()(svr)
assert.Equal(t, time.Duration(test.timeout)*time.Millisecond*4/5, svr.ReadTimeout)
assert.Equal(t, time.Duration(0), svr.ReadHeaderTimeout)
assert.Equal(t, time.Duration(test.timeout)*time.Millisecond*9/10, svr.WriteTimeout)
assert.Equal(t, time.Duration(0), svr.IdleTimeout)
})
}
}
type mockedRouter struct{}
func (m mockedRouter) ServeHTTP(_ http.ResponseWriter, _ *http.Request) {