]> git.kaiwu.me - njs.git/commitdiff
Tests: skipping stream_js_periodic.t for QuickJS engine.
authorDmitry Volyntsev <xeioex@nginx.com>
Sat, 7 Dec 2024 01:37:22 +0000 (17:37 -0800)
committerDmitry Volyntsev <xeioexception@gmail.com>
Wed, 18 Dec 2024 23:44:35 +0000 (15:44 -0800)
nginx/t/stream_js_periodic.t

index 3c4dfd1aacbf2cf3b9517cdbbadd17620a040a1e..4b9e319b46dbd91bd2ff73794522109580b35217 100644 (file)
@@ -53,7 +53,7 @@ stream {
     }
 
     server {
-        listen       127.0.0.1:8080;
+        listen       127.0.0.1:8081;
 
         js_periodic test.tick interval=30ms jitter=1ms;
         js_periodic test.timer interval=1s worker_affinity=all;
@@ -78,10 +78,16 @@ stream {
 http {
     %%TEST_GLOBALS_HTTP%%
 
+    js_import test.js;
+
     server {
-        listen       127.0.0.1:8081;
+        listen       127.0.0.1:8080;
         server_name  localhost;
 
+        location /engine {
+            js_content test.engine;
+        }
+
         location /fetch_ok {
             return 200 'ok';
         }
@@ -94,11 +100,15 @@ http {
 
 EOF
 
-my $p1 = port(8081);
+my $p1 = port(8080);
 
 $t->write_file('test.js', <<EOF);
     import fs from 'fs';
 
+    function engine(r) {
+        r.return(200, njs.engine);
+    }
+
     function affinity() {
         ngx.shared.workers.set(ngx.worker_id, 1);
     }
@@ -266,28 +276,30 @@ $t->write_file('test.js', <<EOF);
 
     export default { affinity, fetch, fetch_exception, js_set, multiple_fetches,
                      file, overrun, test, tick, tick_exception, timer,
-                     timer_exception, timeout_exception, vars };
+                     timer_exception, timeout_exception, vars, engine };
 EOF
 
 $t->run_daemon(\&stream_daemon, port(8090));
-$t->try_run('no js_periodic')->plan(9);
+$t->try_run('no js_periodic');
+plan(skip_all => 'not yet') if http_get('/engine') =~ /QuickJS$/m;
+$t->plan(9);
 $t->waitforsocket('127.0.0.1:' . port(8090));
 
 ###############################################################################
 
 select undef, undef, undef, 0.2;
 
-is(stream('127.0.0.1:' . port(8080))->io('affinity'), 'affinity',
+is(stream('127.0.0.1:' . port(8081))->io('affinity'), 'affinity',
        'affinity test');
-is(stream('127.0.0.1:' . port(8080))->io('tick'), 'tick', '3x tick test');
-is(stream('127.0.0.1:' . port(8080))->io('timer'), 'timer', 'timer test');
-is(stream('127.0.0.1:' . port(8080))->io('file'), 'file', 'file test');
-is(stream('127.0.0.1:' . port(8080))->io('fetch'), 'fetch', 'fetch test');
-is(stream('127.0.0.1:' . port(8080))->io('multiple_fetches'),
+is(stream('127.0.0.1:' . port(8081))->io('tick'), 'tick', '3x tick test');
+is(stream('127.0.0.1:' . port(8081))->io('timer'), 'timer', 'timer test');
+is(stream('127.0.0.1:' . port(8081))->io('file'), 'file', 'file test');
+is(stream('127.0.0.1:' . port(8081))->io('fetch'), 'fetch', 'fetch test');
+is(stream('127.0.0.1:' . port(8081))->io('multiple_fetches'),
        'multiple_fetches', 'muliple fetches test');
-is(stream('127.0.0.1:' . port(8080))->io('timeout_exception'),
+is(stream('127.0.0.1:' . port(8081))->io('timeout_exception'),
        'timeout_exception', 'timeout exception test');
-is(stream('127.0.0.1:' . port(8080))->io('vars'), 'vars', 'vars test');
+is(stream('127.0.0.1:' . port(8081))->io('vars'), 'vars', 'vars test');
 
 $t->stop();