summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-13 22:32:05 +0300
committerWolfy-J <[email protected]>2018-06-13 22:32:05 +0300
commitd1141663c01ba0efdfb71e0a440837967185e8c6 (patch)
tree983ded837a3cefade5297d8730638225e8fec90f /service
parentc2a2912242048c9432c111343d2ae16616c6321f (diff)
error test
Diffstat (limited to 'service')
-rw-r--r--service/http/handler_test.go34
1 files changed, 34 insertions, 0 deletions
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{