From 08d8bc8804577d14031f2f2065896f9e1af303cd Mon Sep 17 00:00:00 2001 From: bunkerity Date: Thu, 21 Jul 2022 14:37:01 +0200 Subject: [PATCH] tests - remove whole subfolders in bw-data --- core/limit/limit.lua | 4 ++-- tests/Test.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/limit/limit.lua b/core/limit/limit.lua index 1141f0c51..04fe24395 100644 --- a/core/limit/limit.lua +++ b/core/limit/limit.lua @@ -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 diff --git a/tests/Test.py b/tests/Test.py index 2f829a016..74dca72c5 100644 --- a/tests/Test.py +++ b/tests/Test.py @@ -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)