summaryrefslogtreecommitdiff
path: root/service/http/handler_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'service/http/handler_test.go')
-rw-r--r--service/http/handler_test.go45
1 files changed, 45 insertions, 0 deletions
diff --git a/service/http/handler_test.go b/service/http/handler_test.go
index 6b44f1ec..d599b1d8 100644
--- a/service/http/handler_test.go
+++ b/service/http/handler_test.go
@@ -731,6 +731,51 @@ func TestServer_Error2(t *testing.T) {
assert.Equal(t, 500, r.StatusCode)
}
+func TestServer_Error3(t *testing.T) {
+ st := &Handler{
+ cfg: &Config{
+ MaxRequest: 1,
+ Uploads: &UploadsConfig{
+ Dir: os.TempDir(),
+ Forbid: []string{},
+ },
+ },
+ rr: roadrunner.NewServer(&roadrunner.ServerConfig{
+ Command: "php ../../php-src/tests/http/client.php pid 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)
+
+ b2 := &bytes.Buffer{}
+ for i := 0; i < 1024*1024; i++ {
+ b2.Write([]byte(" "))
+ }
+
+ req, err := http.NewRequest("POST", "http://localhost"+hs.Addr, b2)
+ assert.NoError(t, err)
+
+ r, err := http.DefaultClient.Do(req)
+ assert.NoError(t, err)
+ defer r.Body.Close()
+
+ assert.NoError(t, err)
+ assert.Equal(t, 500, r.StatusCode)
+}
+
func BenchmarkHandler_Listen_Echo(b *testing.B) {
st := &Handler{
cfg: &Config{