diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/plugins/http/configs/.rr-http-supervised-pool.yaml | 8 | ||||
-rw-r--r-- | tests/plugins/http/http_plugin_test.go | 2 | ||||
-rw-r--r-- | tests/psr-worker-slow.php | 29 |
3 files changed, 33 insertions, 6 deletions
diff --git a/tests/plugins/http/configs/.rr-http-supervised-pool.yaml b/tests/plugins/http/configs/.rr-http-supervised-pool.yaml index e0c38c12..8d4d81d9 100644 --- a/tests/plugins/http/configs/.rr-http-supervised-pool.yaml +++ b/tests/plugins/http/configs/.rr-http-supervised-pool.yaml @@ -2,17 +2,13 @@ rpc: listen: tcp://127.0.0.1:15432 server: command: "php ../../http/client.php echo pipes" - user: "" - group: "" - env: - "RR_HTTP": "true" relay: "pipes" relay_timeout: "20s" http: address: 127.0.0.1:18888 max_request_size: 1024 - middleware: [ "" ] + middleware: [] uploads: forbid: [ ".php", ".exe", ".bat" ] trusted_subnets: [ "10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10" ] @@ -29,4 +25,4 @@ http: max_worker_memory: 100 logs: mode: development - level: error
\ No newline at end of file + level: error diff --git a/tests/plugins/http/http_plugin_test.go b/tests/plugins/http/http_plugin_test.go index fcedb943..c3949911 100644 --- a/tests/plugins/http/http_plugin_test.go +++ b/tests/plugins/http/http_plugin_test.go @@ -1481,6 +1481,8 @@ func informerTestAfter(t *testing.T) { assert.NotZero(t, workerPid) + time.Sleep(time.Second * 5) + err = client.Call("informer.Workers", "http", &list) assert.NoError(t, err) assert.Len(t, list.Workers, 1) diff --git a/tests/psr-worker-slow.php b/tests/psr-worker-slow.php new file mode 100644 index 00000000..153dff68 --- /dev/null +++ b/tests/psr-worker-slow.php @@ -0,0 +1,29 @@ +<?php +/** + * @var Goridge\RelayInterface $relay + */ +use Spiral\Goridge; +use Spiral\RoadRunner; + +ini_set('display_errors', 'stderr'); +require __DIR__ . "/vendor/autoload.php"; + +$worker = new RoadRunner\Worker(new Goridge\StreamRelay(STDIN, STDOUT)); +$psr7 = new RoadRunner\Http\PSR7Worker( + $worker, + new \Nyholm\Psr7\Factory\Psr17Factory(), + new \Nyholm\Psr7\Factory\Psr17Factory(), + new \Nyholm\Psr7\Factory\Psr17Factory() +); + +while ($req = $psr7->waitRequest()) { + try { + $resp = new \Nyholm\Psr7\Response(); + sleep(mt_rand(1,20)); + $resp->getBody()->write("hello world"); + + $psr7->respond($resp); + } catch (\Throwable $e) { + $psr7->getWorker()->error((string)$e); + } +} |