summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2020-05-25 09:07:19 +0300
committerGitHub <[email protected]>2020-05-25 09:07:19 +0300
commited40a2ca731ab183f74d3b7ded395a036db94a20 (patch)
treeac90000e09aa8c82460d63a6ffcce3c4f1aa78b1
parent6a111d01d9ec2f43b2fd0173532a0db101137648 (diff)
parentc1f27bc3e0eb94c394ca4c3dd4e5aeebc879d92f (diff)
Merge pull request #330 from spiral/release_1.8.1
Release 1.8.1
-rw-r--r--CHANGELOG.md5
-rw-r--r--go.mod2
-rw-r--r--service/http/h2c_test.go83
3 files changed, 54 insertions, 36 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index de88fbe9..460cdd0f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,14 +1,15 @@
CHANGELOG
=========
-v1.8.1 (20.05.2020)
+v1.8.1 (23.05.2020)
-------------------
-- Update goridge version to 2.4.2
+- Update goridge version to 2.4.3
- Fix code warnings from phpstan
- Improve RPC
- Create templates for the Bug reporting and Feature requests
- Move docker images from golang-alpine to regular golang images
- Add support for the CloudFlare CF-Connecting-IP and True-Client-IP headers (thanks @vsychov)
+- Add support for the Root CA via the `rootCa` .rr.yaml option
- See the full milestone here: [link](https://github.com/spiral/roadrunner/milestone/11?closed=1)
v1.8.0 (05.05.2020)
diff --git a/go.mod b/go.mod
index cd61ee83..fd7ec10c 100644
--- a/go.mod
+++ b/go.mod
@@ -19,7 +19,7 @@ require (
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.6
github.com/spf13/viper v1.6.2
- github.com/spiral/goridge/v2 v2.4.2
+ github.com/spiral/goridge/v2 v2.4.3
github.com/stretchr/testify v1.4.0
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a
github.com/yookoala/gofast v0.4.0
diff --git a/service/http/h2c_test.go b/service/http/h2c_test.go
index a2465a0a..f17538bc 100644
--- a/service/http/h2c_test.go
+++ b/service/http/h2c_test.go
@@ -1,23 +1,29 @@
package http
import (
+ "net/http"
+ "testing"
+ "time"
+
+ "github.com/cenkalti/backoff/v4"
"github.com/sirupsen/logrus"
"github.com/sirupsen/logrus/hooks/test"
"github.com/spiral/roadrunner/service"
"github.com/stretchr/testify/assert"
- "net/http"
- "testing"
- "time"
)
func Test_Service_H2C(t *testing.T) {
- logger, _ := test.NewNullLogger()
- logger.SetLevel(logrus.DebugLevel)
+ bkoff := backoff.NewExponentialBackOff()
+ bkoff.MaxElapsedTime = time.Second * 15
+
+ err := backoff.Retry(func() error {
+ logger, _ := test.NewNullLogger()
+ logger.SetLevel(logrus.DebugLevel)
- c := service.NewContainer(logger)
- c.Register(ID, &Service{})
+ c := service.NewContainer(logger)
+ c.Register(ID, &Service{})
- assert.NoError(t, c.Init(&testCfg{httpCfg: `{
+ err := c.Init(&testCfg{httpCfg: `{
"address": ":6029",
"http2": {"h2c":true},
"workers":{
@@ -27,40 +33,51 @@ func Test_Service_H2C(t *testing.T) {
"numWorkers": 1
}
}
- }`}))
+ }`})
+ if err != nil {
+ return err
+ }
- s, st := c.Get(ID)
- assert.NotNil(t, s)
- assert.Equal(t, service.StatusOK, st)
+ s, st := c.Get(ID)
+ assert.NotNil(t, s)
+ assert.Equal(t, service.StatusOK, st)
- // should do nothing
- s.(*Service).Stop()
+ // should do nothing
+ s.(*Service).Stop()
+
+ go func() {
+ err := c.Serve()
+ if err != nil {
+ t.Errorf("error serving: %v", err)
+ }
+ }()
+ time.Sleep(time.Millisecond * 100)
+ defer c.Stop()
- go func() {
- err := c.Serve()
+ req, err := http.NewRequest("PRI", "http://localhost:6029?hello=world", nil)
if err != nil {
- t.Errorf("error serving: %v", err)
+ return err
}
- }()
- time.Sleep(time.Millisecond * 100)
- defer c.Stop()
- req, err := http.NewRequest("PRI", "http://localhost:6029?hello=world", nil)
- assert.NoError(t, err)
+ req.Header.Add("Upgrade", "h2c")
+ req.Header.Add("Connection", "HTTP2-Settings")
+ req.Header.Add("HTTP2-Settings", "")
- req.Header.Add("Upgrade", "h2c")
- req.Header.Add("Connection", "HTTP2-Settings")
- req.Header.Add("HTTP2-Settings", "")
+ r, err2 := http.DefaultClient.Do(req)
+ if err2 != nil {
+ return err2
+ }
- r, err2 := http.DefaultClient.Do(req)
- if err2 != nil {
- t.Fatal(err2)
- }
+ assert.Equal(t, "101 Switching Protocols", r.Status)
- assert.Equal(t, "101 Switching Protocols", r.Status)
+ err3 := r.Body.Close()
+ if err3 != nil {
+ return err3
+ }
+ return nil
+ }, bkoff)
- err3 := r.Body.Close()
- if err3 != nil {
- t.Errorf("fail to close the Body: error %v", err3)
+ if err != nil {
+ t.Fatal(err)
}
}