summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-06-26 09:37:27 +0300
committerGitHub <[email protected]>2021-06-26 09:37:27 +0300
commitfc540f6029772ff51913b8ee3c082f8197010c52 (patch)
tree6f92954e4410ff6351e189338daf9fc4dc2feaea /tests
parente9249c7896331bab97a18a7ee0db17803fdd31fb (diff)
parent744bf2e237e92e6ecddd3846dcb9a6b66967f67a (diff)
#738 fix(allocator): workers were not reallocating when `exec_ttl` was hitv2.3.1-rc.1
#738 fix(allocator): workers were not reallocating when `exec_ttl` was hit
Diffstat (limited to 'tests')
-rw-r--r--tests/plugins/http/configs/.rr-http-supervised-pool.yaml8
-rw-r--r--tests/plugins/http/http_plugin_test.go2
-rw-r--r--tests/psr-worker-slow.php29
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);
+ }
+}