From d1141663c01ba0efdfb71e0a440837967185e8c6 Mon Sep 17 00:00:00 2001 From: Wolfy-J Date: Wed, 13 Jun 2018 22:32:05 +0300 Subject: error test --- service/http/handler_test.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'service/http') diff --git a/service/http/handler_test.go b/service/http/handler_test.go index eee905ba..80a1b52c 100644 --- a/service/http/handler_test.go +++ b/service/http/handler_test.go @@ -663,6 +663,40 @@ func TestServer_Multipart_PATCH(t *testing.T) { assert.Equal(t, `{"arr":{"c":{"p":"l","z":""},"x":{"y":{"e":"f","z":"y"}}},"key":"value","name":["name1","name2","name3"]}`, string(b)) } +func TestServer_Error(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 error 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{ -- cgit v1.2.3