diff options
author | Valery Piashchynski <[email protected]> | 2020-02-28 00:25:52 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2020-02-28 00:25:52 +0300 |
commit | 490114908c8017c542cf073bdad814687ab3e4b9 (patch) | |
tree | 672aab7d8f56d2638688fab61af960651e5b87cb | |
parent | 69ee8c03d58bb8eff74ced36b849295f316ee61b (diff) |
H2C test update
-rw-r--r-- | service/http/h2c_test.go | 17 | ||||
-rw-r--r-- | static_pool_test.go | 8 |
2 files changed, 12 insertions, 13 deletions
diff --git a/service/http/h2c_test.go b/service/http/h2c_test.go index 7bbc30ac..a2465a0a 100644 --- a/service/http/h2c_test.go +++ b/service/http/h2c_test.go @@ -52,16 +52,15 @@ func Test_Service_H2C(t *testing.T) { req.Header.Add("Connection", "HTTP2-Settings") req.Header.Add("HTTP2-Settings", "") - r, err := http.DefaultClient.Do(req) - assert.NoError(t, err) - defer func() { - err := r.Body.Close() - if err != nil { - t.Errorf("fail to close the Body: error %v", err) - } - }() + r, err2 := http.DefaultClient.Do(req) + if err2 != nil { + t.Fatal(err2) + } assert.Equal(t, "101 Switching Protocols", r.Status) - // will fail with h2c notice + err3 := r.Body.Close() + if err3 != nil { + t.Errorf("fail to close the Body: error %v", err3) + } } diff --git a/static_pool_test.go b/static_pool_test.go index b264fa64..05650d17 100644 --- a/static_pool_test.go +++ b/static_pool_test.go @@ -219,7 +219,7 @@ func Test_StaticPool_AllocateTimeout(t *testing.T) { Config{ NumWorkers: 1, AllocateTimeout: time.Millisecond * 50, - DestroyTimeout: time.Second, + DestroyTimeout: time.Second * 2, }, ) if err != nil { @@ -242,10 +242,10 @@ func Test_StaticPool_AllocateTimeout(t *testing.T) { time.Sleep(time.Millisecond * 10) _, err = p.Exec(&Payload{Body: []byte("10")}) - assert.Error(t, err) - if err != nil { - assert.Contains(t, err.Error(), "worker timeout") + if err == nil { + t.Fatal("Test_StaticPool_AllocateTimeout exec should raise error") } + assert.Contains(t, err.Error(), "worker timeout") <-done p.Destroy() |