summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorValery Piashchynski <[email protected]>2021-07-18 11:32:44 +0300
committerValery Piashchynski <[email protected]>2021-07-18 11:32:44 +0300
commit9c51360f9119a4114bdcc21c8e61f0908a3c876d (patch)
treeea63a051931bbd8282d64478bbefa2f970fcc955 /tests
parentf4feb30197843d05eb308081ee579d3a9e3d6206 (diff)
Started beanstalk driver. Add new Queue impl (not finished yet).
Fix bugs in the AMQP, update proto-api Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r--tests/plugins/jobs/configs/.rr-jobs-test.yaml2
-rw-r--r--tests/plugins/jobs/jobs_plugin_test.go5
-rw-r--r--tests/psr-worker-bench.php75
3 files changed, 25 insertions, 57 deletions
diff --git a/tests/plugins/jobs/configs/.rr-jobs-test.yaml b/tests/plugins/jobs/configs/.rr-jobs-test.yaml
index ee72c2b7..6e2733dd 100644
--- a/tests/plugins/jobs/configs/.rr-jobs-test.yaml
+++ b/tests/plugins/jobs/configs/.rr-jobs-test.yaml
@@ -36,7 +36,7 @@ jobs:
pipeline_size: 100000
# worker pool configuration
pool:
- num_workers: 10
+ num_workers: 20
max_jobs: 0
allocate_timeout: 60s
destroy_timeout: 60s
diff --git a/tests/plugins/jobs/jobs_plugin_test.go b/tests/plugins/jobs/jobs_plugin_test.go
index 9a13435b..59f55f3d 100644
--- a/tests/plugins/jobs/jobs_plugin_test.go
+++ b/tests/plugins/jobs/jobs_plugin_test.go
@@ -123,7 +123,6 @@ func TestJobsInit(t *testing.T) {
mockLogger.EXPECT().Info("driver ready", "pipeline", "test-2", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
mockLogger.EXPECT().Info("driver ready", "pipeline", "test-3", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
-
mockLogger.EXPECT().Info("pipeline started", "pipeline", "test-local-2", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
mockLogger.EXPECT().Info("pipeline started", "pipeline", "test-1", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
mockLogger.EXPECT().Info("pipeline started", "pipeline", "test-2-amqp", "start", gomock.Any(), "elapsed", gomock.Any()).Times(1)
@@ -337,7 +336,7 @@ func ephemeralPause(t *testing.T) {
assert.NoError(t, err)
client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn))
- pipe := &jobsv1beta.MaintenanceRequest{Pipelines: make([]string, 1)}
+ pipe := &jobsv1beta.Maintenance{Pipelines: make([]string, 1)}
pipe.GetPipelines()[0] = "test-local"
er := &jobsv1beta.Empty{}
@@ -350,7 +349,7 @@ func ephemeralResume(t *testing.T) {
assert.NoError(t, err)
client := rpc.NewClientWithCodec(goridgeRpc.NewClientCodec(conn))
- pipe := &jobsv1beta.MaintenanceRequest{Pipelines: make([]string, 1)}
+ pipe := &jobsv1beta.Maintenance{Pipelines: make([]string, 1)}
pipe.GetPipelines()[0] = "test-local"
er := &jobsv1beta.Empty{}
diff --git a/tests/psr-worker-bench.php b/tests/psr-worker-bench.php
index b4a028d4..80fc435c 100644
--- a/tests/psr-worker-bench.php
+++ b/tests/psr-worker-bench.php
@@ -1,59 +1,28 @@
<?php
-
-declare(strict_types=1);
-
+/**
+ * @var Goridge\RelayInterface $relay
+ */
+use Spiral\Goridge;
use Spiral\RoadRunner;
-use Nyholm\Psr7\Factory;
ini_set('display_errors', 'stderr');
-include "vendor/autoload.php";
-
-$env = \Spiral\RoadRunner\Environment::fromGlobals();
-
-if ($env->getMode() === 'http') {
- $worker = new RoadRunner\Http\PSR7Worker(
- RoadRunner\Worker::create(),
- new Factory\Psr17Factory(),
- new Factory\Psr17Factory(),
- new Factory\Psr17Factory()
- );
-
- while ($req = $worker->waitRequest()) {
- try {
- $rsp = new \Nyholm\Psr7\Response();
- $rsp->getBody()->write("hello world");
- $worker->respond($rsp);
- } catch (\Throwable $e) {
- $worker->getWorker()->error((string)$e);
- }
+require __DIR__ . "/vendor/autoload.php";
+
+$worker = RoadRunner\Worker::create();
+$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();
+ $resp->getBody()->write("hello world");
+
+ $psr7->respond($resp);
+ } catch (\Throwable $e) {
+ $psr7->getWorker()->error((string)$e);
}
-} else {
- /**
- * @param string $dir
- * @return array<string>
- */
- $getClasses = static function (string $dir): iterable {
- $files = glob($dir . '/*.php');
-
- foreach ($files as $file) {
- yield substr(basename($file), 0, -4);
- }
- };
-
- $factory = \Temporal\WorkerFactory::create();
-
- $worker = $factory->newWorker('default');
-
- // register all workflows
- foreach ($getClasses(__DIR__ . '/src/Workflow') as $name) {
- $worker->registerWorkflowTypes('Temporal\\Tests\\Workflow\\' . $name);
- }
-
- // register all activity
- foreach ($getClasses(__DIR__ . '/src/Activity') as $name) {
- $class = 'Temporal\\Tests\\Activity\\' . $name;
- $worker->registerActivityImplementations(new $class);
- }
-
- $factory->run();
}