tests - remove whole subfolders in bw-data

This commit is contained in:
bunkerity 2022-07-21 14:37:01 +02:00
parent b38f7c54e6
commit 08d8bc8804
No known key found for this signature in database
GPG Key ID: 3D80806F12602A7C
2 changed files with 3 additions and 3 deletions

View File

@ -102,7 +102,7 @@ function _M:access()
local _, _, rate_max, rate_time = rate:find("(%d+)r/(.)")
-- Get current requests timestamps
local requests, err = datastore:get("plugin_limit_cache_" .. ngx.var.remote_addr .. ngx.var.uri)
local requests, err = datastore:get("plugin_limit_cache_" .. ngx.var.server_name .. ngx.var.remote_addr .. ngx.var.uri)
if not requests and err ~= "not found" then
return false, err, nil, nil
elseif err == "not found" then
@ -133,7 +133,7 @@ function _M:access()
end
-- Save the new timestamps
local ok, err = datastore:set("plugin_limit_cache_" .. ngx.var.remote_addr .. ngx.var.uri, cjson.encode(new_timestamps), delay)
local ok, err = datastore:set("plugin_limit_cache_" .. ngx.var.server_name .. ngx.var.remote_addr .. ngx.var.uri, cjson.encode(new_timestamps), delay)
if not ok then
return false, "can't update timestamps : " .. err, nil, nil
end

View File

@ -50,7 +50,7 @@ class Test(ABC) :
rm_dirs = ["configs", "plugins", "www"]
for rm_dir in rm_dirs :
if isdir("/tmp/bw-data/" + rm_dir) :
run("sudo rm -rf /tmp/bw-data/" + rm_dir + "/*", shell=True)
run("sudo rm -rf /tmp/bw-data/" + rm_dir, shell=True)
if isdir("/tmp/tests/" + self._name) :
run("sudo rm -rf /tmp/tests/" + self._name, shell=True)
copytree("./examples/" + self._name, "/tmp/tests/" + self._name)