File: pipe-multi-workers.t

package info (click to toggle)
lua-resty-core 0.1.31-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,176 kB
  • sloc: perl: 143; sh: 59; makefile: 26
file content (44 lines) | stat: -rw-r--r-- 908 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# vim:set ft= ts=4 sw=4 et fdm=marker:
use lib '.';
use t::TestCore;

workers(2);
master_on();

repeat_each(1);

plan tests => repeat_each() * (blocks() * 2);

check_accum_error_log();
run_tests();

__DATA__

=== TEST 1: ngx.worker.count
--- http_config
    init_worker_by_lua_block {
        ngx.timer.at(0, function()
            local ngx_pipe = require "ngx.pipe"

            local function check_error(...)
                local data, err = pcall(...)
                if not data then
                    ngx.log(ngx.ERR, err)
                end
            end

            check_error(ngx_pipe.spawn, {"ls"})
        end)
    }
--- config
    listen $TEST_NGINX_RAND_PORT_1 reuseport;
    location = /t {
        content_by_lua_block {
            ngx.sleep(0.01) -- ensure timer is fired
            ngx.say("ok")
        }
    }
--- request
GET /t
--- no_error_log
failed (9: Bad file descriptor)