summaryrefslogtreecommitdiff
path: root/tests/plugins/http
diff options
context:
space:
mode:
Diffstat (limited to 'tests/plugins/http')
-rw-r--r--tests/plugins/http/attributes_test.go2
-rw-r--r--tests/plugins/http/handler_test.go2
-rw-r--r--tests/plugins/http/http_plugin_test.go (renamed from tests/plugins/http/http_test.go)85
-rw-r--r--tests/plugins/http/parse_test.go2
-rw-r--r--tests/plugins/http/plugin1.go2
-rw-r--r--tests/plugins/http/plugin_middleware.go2
-rw-r--r--tests/plugins/http/response_test.go2
-rw-r--r--tests/plugins/http/uploads_config_test.go2
-rw-r--r--tests/plugins/http/uploads_test.go2
9 files changed, 63 insertions, 38 deletions
diff --git a/tests/plugins/http/attributes_test.go b/tests/plugins/http/attributes_test.go
index 54998906..69200a30 100644
--- a/tests/plugins/http/attributes_test.go
+++ b/tests/plugins/http/attributes_test.go
@@ -4,7 +4,7 @@ import (
"net/http"
"testing"
- "github.com/spiral/roadrunner/v2/pkg/plugins/http/attributes"
+ "github.com/spiral/roadrunner/v2/plugins/http/attributes"
"github.com/stretchr/testify/assert"
)
diff --git a/tests/plugins/http/handler_test.go b/tests/plugins/http/handler_test.go
index 193bf0cf..18558296 100644
--- a/tests/plugins/http/handler_test.go
+++ b/tests/plugins/http/handler_test.go
@@ -11,8 +11,8 @@ import (
"strings"
"github.com/spiral/roadrunner/v2/pkg/pipe"
- httpPlugin "github.com/spiral/roadrunner/v2/pkg/plugins/http"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
+ httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/stretchr/testify/assert"
"net/http"
diff --git a/tests/plugins/http/http_test.go b/tests/plugins/http/http_plugin_test.go
index f4a357f2..88857df5 100644
--- a/tests/plugins/http/http_test.go
+++ b/tests/plugins/http/http_plugin_test.go
@@ -19,18 +19,18 @@ import (
"github.com/golang/mock/gomock"
"github.com/spiral/endure"
goridgeRpc "github.com/spiral/goridge/v3/pkg/rpc"
- "github.com/spiral/roadrunner-plugins/config"
- "github.com/spiral/roadrunner-plugins/logger"
- "github.com/spiral/roadrunner-plugins/resetter"
"github.com/spiral/roadrunner/v2/interfaces/events"
- "github.com/spiral/roadrunner/v2/pkg/plugins/informer"
- "github.com/spiral/roadrunner/v2/pkg/plugins/server"
+ "github.com/spiral/roadrunner/v2/plugins/config"
+ "github.com/spiral/roadrunner/v2/plugins/informer"
+ "github.com/spiral/roadrunner/v2/plugins/logger"
+ "github.com/spiral/roadrunner/v2/plugins/resetter"
+ "github.com/spiral/roadrunner/v2/plugins/server"
"github.com/spiral/roadrunner/v2/tests/mocks"
"github.com/spiral/roadrunner/v2/tools"
"github.com/yookoala/gofast"
- rpcPlugin "github.com/spiral/roadrunner-plugins/rpc"
- httpPlugin "github.com/spiral/roadrunner/v2/pkg/plugins/http"
+ httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
+ rpcPlugin "github.com/spiral/roadrunner/v2/plugins/rpc"
"github.com/stretchr/testify/assert"
)
@@ -74,7 +74,7 @@ func TestHTTPInit(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 5)
+ stopCh := make(chan struct{}, 1)
go func() {
defer wg.Done()
@@ -92,7 +92,7 @@ func TestHTTPInit(t *testing.T) {
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -103,6 +103,7 @@ func TestHTTPInit(t *testing.T) {
}
}()
+ stopCh <- struct{}{}
wg.Wait()
}
@@ -140,8 +141,9 @@ func TestHTTPInformerReset(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
+ stopCh := make(chan struct{}, 1)
+
go func() {
- tt := time.NewTimer(time.Second * 10)
defer wg.Done()
for {
select {
@@ -157,7 +159,7 @@ func TestHTTPInformerReset(t *testing.T) {
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -174,6 +176,8 @@ func TestHTTPInformerReset(t *testing.T) {
t.Run("HTTPResetTest", resetTest)
t.Run("HTTPEchoTestAfter", echoHTTP)
+ stopCh <- struct{}{}
+
wg.Wait()
}
@@ -258,7 +262,8 @@ func TestSSL(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 10)
+
+ stopCh := make(chan struct{}, 1)
go func() {
defer wg.Done()
@@ -276,7 +281,7 @@ func TestSSL(t *testing.T) {
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -291,6 +296,8 @@ func TestSSL(t *testing.T) {
t.Run("SSLEcho", sslEcho)
t.Run("SSLNoRedirect", sslNoRedirect)
t.Run("fCGIecho", fcgiEcho)
+
+ stopCh <- struct{}{}
wg.Wait()
}
@@ -392,7 +399,8 @@ func TestSSLRedirect(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 10)
+ stopCh := make(chan struct{}, 1)
+
go func() {
defer wg.Done()
for {
@@ -409,7 +417,7 @@ func TestSSLRedirect(t *testing.T) {
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -422,6 +430,8 @@ func TestSSLRedirect(t *testing.T) {
time.Sleep(time.Second * 1)
t.Run("SSLRedirect", sslRedirect)
+
+ stopCh <- struct{}{}
wg.Wait()
}
@@ -477,7 +487,8 @@ func TestSSLPushPipes(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 10)
+ stopCh := make(chan struct{}, 1)
+
go func() {
defer wg.Done()
for {
@@ -494,7 +505,7 @@ func TestSSLPushPipes(t *testing.T) {
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -507,6 +518,8 @@ func TestSSLPushPipes(t *testing.T) {
time.Sleep(time.Second * 1)
t.Run("SSLPush", sslPush)
+
+ stopCh <- struct{}{}
wg.Wait()
}
@@ -565,7 +578,7 @@ func TestFastCGI_RequestUri(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 10)
+ stopCh := make(chan struct{}, 1)
go func() {
defer wg.Done()
@@ -583,7 +596,7 @@ func TestFastCGI_RequestUri(t *testing.T) {
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -596,6 +609,8 @@ func TestFastCGI_RequestUri(t *testing.T) {
time.Sleep(time.Second * 1)
t.Run("FastCGIServiceRequestUri", fcgiReqURI)
+
+ stopCh <- struct{}{}
wg.Wait()
}
@@ -650,7 +665,7 @@ func TestH2CUpgrade(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 10)
+ stopCh := make(chan struct{}, 1)
go func() {
defer wg.Done()
@@ -668,7 +683,7 @@ func TestH2CUpgrade(t *testing.T) {
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -681,6 +696,8 @@ func TestH2CUpgrade(t *testing.T) {
time.Sleep(time.Second * 1)
t.Run("H2cUpgrade", h2cUpgrade)
+
+ stopCh <- struct{}{}
wg.Wait()
}
@@ -739,7 +756,7 @@ func TestH2C(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 10)
+ stopCh := make(chan struct{}, 1)
go func() {
defer wg.Done()
@@ -757,7 +774,7 @@ func TestH2C(t *testing.T) {
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -770,6 +787,8 @@ func TestH2C(t *testing.T) {
time.Sleep(time.Second * 1)
t.Run("H2c", h2c)
+
+ stopCh <- struct{}{}
wg.Wait()
}
@@ -829,7 +848,7 @@ func TestHttpMiddleware(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 20)
+ stopCh := make(chan struct{}, 1)
go func() {
defer wg.Done()
@@ -847,7 +866,7 @@ func TestHttpMiddleware(t *testing.T) {
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -860,6 +879,8 @@ func TestHttpMiddleware(t *testing.T) {
time.Sleep(time.Second * 1)
t.Run("MiddlewareTest", middleware)
+
+ stopCh <- struct{}{}
wg.Wait()
}
@@ -895,7 +916,7 @@ func middleware(t *testing.T) {
}
func TestHttpEchoErr(t *testing.T) {
- cont, err := endure.NewContainer(nil, endure.SetLogLevel(endure.DebugLevel))
+ cont, err := endure.NewContainer(nil, endure.SetLogLevel(endure.ErrorLevel))
assert.NoError(t, err)
rIn := `
@@ -971,7 +992,7 @@ logs:
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 10)
+ stopCh := make(chan struct{}, 1)
go func() {
defer wg.Done()
@@ -989,7 +1010,7 @@ logs:
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -1002,6 +1023,8 @@ logs:
time.Sleep(time.Second * 1)
t.Run("HttpEchoError", echoError)
+
+ stopCh <- struct{}{}
wg.Wait()
}
@@ -1054,7 +1077,7 @@ func TestHttpEnvVariables(t *testing.T) {
wg := &sync.WaitGroup{}
wg.Add(1)
- tt := time.NewTimer(time.Second * 10)
+ stopCh := make(chan struct{}, 1)
go func() {
defer wg.Done()
@@ -1072,7 +1095,7 @@ func TestHttpEnvVariables(t *testing.T) {
assert.FailNow(t, "error", err.Error())
}
return
- case <-tt.C:
+ case <-stopCh:
// timeout
err = cont.Stop()
if err != nil {
@@ -1085,6 +1108,8 @@ func TestHttpEnvVariables(t *testing.T) {
time.Sleep(time.Second * 1)
t.Run("EnvVariablesTest", envVarsTest)
+
+ stopCh <- struct{}{}
wg.Wait()
}
diff --git a/tests/plugins/http/parse_test.go b/tests/plugins/http/parse_test.go
index df217202..5cc1ce32 100644
--- a/tests/plugins/http/parse_test.go
+++ b/tests/plugins/http/parse_test.go
@@ -3,7 +3,7 @@ package http
import (
"testing"
- "github.com/spiral/roadrunner/v2/pkg/plugins/http"
+ "github.com/spiral/roadrunner/v2/plugins/http"
)
var samples = []struct {
diff --git a/tests/plugins/http/plugin1.go b/tests/plugins/http/plugin1.go
index da887da8..0ec31211 100644
--- a/tests/plugins/http/plugin1.go
+++ b/tests/plugins/http/plugin1.go
@@ -1,7 +1,7 @@
package http
import (
- "github.com/spiral/roadrunner-plugins/config"
+ "github.com/spiral/roadrunner/v2/plugins/config"
)
type Plugin1 struct {
diff --git a/tests/plugins/http/plugin_middleware.go b/tests/plugins/http/plugin_middleware.go
index 6d67725d..8d02524d 100644
--- a/tests/plugins/http/plugin_middleware.go
+++ b/tests/plugins/http/plugin_middleware.go
@@ -3,7 +3,7 @@ package http
import (
"net/http"
- "github.com/spiral/roadrunner-plugins/config"
+ "github.com/spiral/roadrunner/v2/plugins/config"
)
type PluginMiddleware struct {
diff --git a/tests/plugins/http/response_test.go b/tests/plugins/http/response_test.go
index 229163a2..a9cbf91a 100644
--- a/tests/plugins/http/response_test.go
+++ b/tests/plugins/http/response_test.go
@@ -7,7 +7,7 @@ import (
"testing"
"github.com/spiral/roadrunner/v2/pkg/payload"
- httpPlugin "github.com/spiral/roadrunner/v2/pkg/plugins/http"
+ httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/stretchr/testify/assert"
)
diff --git a/tests/plugins/http/uploads_config_test.go b/tests/plugins/http/uploads_config_test.go
index 4a7927c5..e76078ee 100644
--- a/tests/plugins/http/uploads_config_test.go
+++ b/tests/plugins/http/uploads_config_test.go
@@ -4,7 +4,7 @@ import (
"os"
"testing"
- httpPlugin "github.com/spiral/roadrunner/v2/pkg/plugins/http"
+ httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/stretchr/testify/assert"
)
diff --git a/tests/plugins/http/uploads_test.go b/tests/plugins/http/uploads_test.go
index e71ff8c1..7bb25cbf 100644
--- a/tests/plugins/http/uploads_test.go
+++ b/tests/plugins/http/uploads_test.go
@@ -17,8 +17,8 @@ import (
j "github.com/json-iterator/go"
"github.com/spiral/roadrunner/v2/pkg/pipe"
- httpPlugin "github.com/spiral/roadrunner/v2/pkg/plugins/http"
poolImpl "github.com/spiral/roadrunner/v2/pkg/pool"
+ httpPlugin "github.com/spiral/roadrunner/v2/plugins/http"
"github.com/stretchr/testify/assert"
)