summaryrefslogtreecommitdiff
path: root/tests/plugins/http/http_plugin_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'tests/plugins/http/http_plugin_test.go')
-rw-r--r--tests/plugins/http/http_plugin_test.go41
1 files changed, 38 insertions, 3 deletions
diff --git a/tests/plugins/http/http_plugin_test.go b/tests/plugins/http/http_plugin_test.go
index 73d6d102..0e43dac4 100644
--- a/tests/plugins/http/http_plugin_test.go
+++ b/tests/plugins/http/http_plugin_test.go
@@ -1227,10 +1227,43 @@ func TestHttpBrokenPipes(t *testing.T) {
err = cont.Init()
assert.NoError(t, err)
- _, err = cont.Serve()
- assert.Error(t, err)
+ ch, err := cont.Serve()
+ assert.NoError(t, err)
+
+ sig := make(chan os.Signal, 1)
+ signal.Notify(sig, os.Interrupt, syscall.SIGINT, syscall.SIGTERM)
+
+ wg := &sync.WaitGroup{}
+ wg.Add(1)
+
+ stopCh := make(chan struct{}, 1)
+
+ go func() {
+ defer wg.Done()
+ for {
+ select {
+ // should be error from the plugin
+ case e := <-ch:
+ assert.Error(t, e.Error)
+ return
+ case <-sig:
+ err = cont.Stop()
+ if err != nil {
+ assert.FailNow(t, "error", err.Error())
+ }
+ return
+ case <-stopCh:
+ // timeout
+ err = cont.Stop()
+ if err != nil {
+ assert.FailNow(t, "error", err.Error())
+ }
+ return
+ }
+ }
+ }()
- assert.NoError(t, cont.Stop())
+ wg.Wait()
}
func TestHTTPSupervisedPool(t *testing.T) {
@@ -1512,6 +1545,8 @@ func TestHTTPBigRequestSize(t *testing.T) {
}
}()
+ time.Sleep(time.Second * 2)
+
t.Run("HTTPBigEcho10Mb", bigEchoHTTP)
stopCh <- struct{}{}