Last active
April 17, 2020 04:44
-
-
Save wanghuizzz/61e4da9279a635471d8cd31253d4c99d to your computer and use it in GitHub Desktop.
no-memory-test.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== TEST 93: no memory test | |
--- http_config | |
lua_shared_dict dogs 1m; | |
--- config | |
location = /test { | |
content_by_lua ' | |
local dogs = ngx.shared.dogs | |
local value_small = string.rep("1", 32) | |
local value_large = string.rep("1", 128) | |
local ok, err | |
for i = 1, 30000 do | |
ok, err = dogs:add(i, value_small) | |
if not ok then | |
ngx.log(ngx.ERR, "failed add ,err = "..err) | |
end | |
end | |
for i = 30001, 30002 do | |
ok, err = dogs:add(i, value_large) | |
if not ok then | |
ngx.log(ngx.ERR, "failed add ,err = "..err) | |
end | |
end | |
'; | |
} | |
--- request | |
GET /test | |
--- error_log | |
failed add ,err = no memory | |
=== TEST 94: no memory test | |
--- http_config | |
lua_shared_dict dogs 1m; | |
--- config | |
location = /test { | |
content_by_lua ' | |
local dogs = ngx.shared.dogs | |
local value_small = string.rep("1", 32) | |
local value_large = string.rep("1", 128) | |
local ok, err | |
for i = 1, 30000 do | |
ok, err = dogs:add(i, value_large) | |
if not ok then | |
ngx.log(ngx.ERR, "failed add ,err = "..err) | |
end | |
end | |
for i = 30001, 30002 do | |
ok, err = dogs:add(i, value_large) | |
if not ok then | |
ngx.log(ngx.ERR, "failed add ,err = "..err) | |
end | |
end | |
'; | |
} | |
--- request | |
GET /test | |
--- no_error_log | |
[error] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment