Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 156 additions & 1 deletion t/00-init_mdb.t
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ __DATA__
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"))
Expand All @@ -48,3 +47,159 @@ nil
[error]
[warn]
[crit]



=== TEST 2: single key edge cases set() / get() (16359)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(16359)
l.set("a", v)
ngx.say(v == l.get("a"))
}
}
--- request
GET /t
--- response_body
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 3: single key edge cases set() / get() (16360)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(16360)
l.set("a", v)
ngx.say(v == l.get("a"))
}
}
--- request
GET /t
--- response_body
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 4: single key edge cases set() / get() (16361)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(16361)
l.set("a", v)
ngx.say(v == l.get("a"))
}
}
--- request
GET /t
--- response_body
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 5: three keys key edge cases set() / get() (5442)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(5442)
l.set("a", v)
l.set("b", v)
l.set("c", v)
ngx.say(v == l.get("a"))
ngx.say(v == l.get("b"))
ngx.say(v == l.get("c"))
}
}
--- request
GET /t
--- response_body
true
true
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 6: three keys edge cases set() / get() (5443)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(5443)
l.set("a", v)
l.set("b", v)
l.set("c", v)
ngx.say(v == l.get("a"))
ngx.say(v == l.get("b"))
ngx.say(v == l.get("c"))
}
}
--- request
GET /t
--- response_body
true
true
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 7: three keys edge cases set() / get() (5444)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(5444)
l.set("a", v)
l.set("b", v)
l.set("c", v)
ngx.say(v == l.get("a"))
ngx.say(v == l.get("b"))
ngx.say(v == l.get("c"))
}
}
--- request
GET /t
--- response_body
true
true
true
--- no_error_log
[error]
[warn]
[crit]
164 changes: 161 additions & 3 deletions t/05-encrypt_and_find_plaintext.t
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,163 @@ nil



=== TEST 2: clear using set()
=== TEST 2: single key edge cases set() / get() (16359)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(16359)
l.set("a", v)
ngx.say(v == l.get("a"))
}
}
--- request
GET /t
--- response_body
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 3: single key edge cases set() / get() (16360)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(16360)
l.set("a", v)
ngx.say(v == l.get("a"))
}
}
--- request
GET /t
--- response_body
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 4: single key edge cases set() / get() (16361)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(16361)
l.set("a", v)
ngx.say(v == l.get("a"))
}
}
--- request
GET /t
--- response_body
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 5: three keys key edge cases set() / get() (5442)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(5442)
l.set("a", v)
l.set("b", v)
l.set("c", v)
ngx.say(v == l.get("a"))
ngx.say(v == l.get("b"))
ngx.say(v == l.get("c"))
}
}
--- request
GET /t
--- response_body
true
true
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 6: three keys edge cases set() / get() (5443)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(5443)
l.set("a", v)
l.set("b", v)
l.set("c", v)
ngx.say(v == l.get("a"))
ngx.say(v == l.get("b"))
ngx.say(v == l.get("c"))
}
}
--- request
GET /t
--- response_body
true
true
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 7: three keys edge cases set() / get() (5444)
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
location = /t {
content_by_lua_block {
local l = require("resty.lmdb")
local v = ("a"):rep(5444)
l.set("a", v)
l.set("b", v)
l.set("c", v)
ngx.say(v == l.get("a"))
ngx.say(v == l.get("b"))
ngx.say(v == l.get("c"))
}
}
--- request
GET /t
--- response_body
true
true
true
--- no_error_log
[error]
[warn]
[crit]



=== TEST 8: clear using set()
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
Expand All @@ -107,7 +263,7 @@ nil



=== TEST 3: db_drop()
=== TEST 9: db_drop()
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig
--- config
Expand All @@ -131,7 +287,9 @@ nil
[warn]
[crit]

=== TEST 4: simple set() / get()


=== TEST 10: simple set() / get()
--- http_config eval: $::HttpConfig
--- main_config eval: $::MainConfig1
--- config
Expand Down