diff options
author | Wolfy-J <[email protected]> | 2018-06-13 22:33:17 +0300 |
---|---|---|
committer | Wolfy-J <[email protected]> | 2018-06-13 22:33:17 +0300 |
commit | 7b8724b181e6d11b6a8f367a64a3dc519aa1ee8b (patch) | |
tree | 956f3eef323de9baab315d6a728718815dbc97ec /service | |
parent | d1141663c01ba0efdfb71e0a440837967185e8c6 (diff) |
error test
Diffstat (limited to 'service')
-rw-r--r-- | service/http/handler_test.go | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/service/http/handler_test.go b/service/http/handler_test.go index 80a1b52c..6b44f1ec 100644 --- a/service/http/handler_test.go +++ b/service/http/handler_test.go @@ -697,6 +697,40 @@ func TestServer_Error(t *testing.T) { assert.Equal(t, 500, r.StatusCode) } +func TestServer_Error2(t *testing.T) { + st := &Handler{ + cfg: &Config{ + MaxRequest: 1024, + Uploads: &UploadsConfig{ + Dir: os.TempDir(), + Forbid: []string{}, + }, + }, + rr: roadrunner.NewServer(&roadrunner.ServerConfig{ + Command: "php ../../php-src/tests/http/client.php error2 pipes", + Relay: "pipes", + Pool: &roadrunner.Config{ + NumWorkers: 1, + AllocateTimeout: 10000000, + DestroyTimeout: 10000000, + }, + }), + } + + assert.NoError(t, st.rr.Start()) + defer st.rr.Stop() + + hs := &http.Server{Addr: ":8077", Handler: st} + defer hs.Shutdown(context.Background()) + + go func() { hs.ListenAndServe() }() + time.Sleep(time.Millisecond * 10) + + _, r, err := get("http://localhost:8077/?hello=world") + assert.NoError(t, err) + assert.Equal(t, 500, r.StatusCode) +} + func BenchmarkHandler_Listen_Echo(b *testing.B) { st := &Handler{ cfg: &Config{ |