Skip to content

Commit

Permalink
test(env): Add test for a lot readers
Browse files Browse the repository at this point in the history
  • Loading branch information
Oyami-Srk committed Nov 13, 2024
1 parent bc5b3a6 commit 904a1d4
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions t/12-max-readers.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# vim:set ft= ts=4 sw=4 et:

use Test::Nginx::Socket::Lua;
use Cwd qw(cwd);

repeat_each(2);

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

my $pwd = cwd();

our $MainConfig = qq{
lmdb_environment_path /tmp/test.mdb;
lmdb_map_size 5m;
};

our $HttpConfig = qq{
lua_package_path "$pwd/lib/?.lua;;";
init_worker_by_lua_block {
local lmdb_set = require("resty.lmdb").set
lmdb_set("worker" .. ngx.worker.id(), tostring(ngx.worker.id()))
}
};

no_long_string();
#no_diff();

master_process_enabled('on');
workers(200);

run_tests();

__DATA__

=== TEST 1: simple set() / get()
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
ngx.say(l.set("test", "value"))
ngx.say(l.get("test"))
ngx.say(l.get("test_not_exist"))
}
}
--- request
GET /t
--- response_body
true
value
nil
--- no_error_log
[error]
[warn]
[crit]

0 comments on commit 904a1d4

Please sign in to comment.