Skip to content

Commit

Permalink
tests: remove prefix directory when stop_kong called (#12713)
Browse files Browse the repository at this point in the history
* chore(test): remove prefix directory when stop_kong called (#12691)

If the prefix is not cleaned up when stop_kong is called,
it could impact subsequent tests, especially when later tests
start Kong by a shell command, the Kong instance might
be started up with the default `servroot` prefix.

KAG-3808

(cherry picked from commit 3dd5bdb)

* remove prefix directory for 2.8
  • Loading branch information
Water-Melon authored Mar 12, 2024
1 parent 89ef0a2 commit 5308d9e
Show file tree
Hide file tree
Showing 25 changed files with 51 additions and 51 deletions.
4 changes: 2 additions & 2 deletions spec/02-integration/02-cmd/03-reload_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("kong reload #" .. strategy, function()
helpers.clean_prefix()
end)
after_each(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

it("send a 'reload' signal to a running Nginx master process", function()
Expand Down Expand Up @@ -580,7 +580,7 @@ describe("key-auth plugin invalidation on dbless reload #off", function()

finally(function()
os.remove(yaml_file)
helpers.stop_kong(helpers.test_conf.prefix, true)
helpers.stop_kong(helpers.test_conf.prefix)
if admin_client then
admin_client:close()
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe("Admin API (#" .. strategy .. "): ", function()
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
4 changes: 2 additions & 2 deletions spec/02-integration/04-admin_api/09-routes_routes_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down Expand Up @@ -1909,7 +1909,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
8 changes: 4 additions & 4 deletions spec/02-integration/04-admin_api/15-off_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("Admin API #off", function()
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down Expand Up @@ -870,7 +870,7 @@ describe("Admin API (concurrency tests) #off", function()
end)

after_each(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()

if client then
client:close()
Expand Down Expand Up @@ -991,7 +991,7 @@ describe("Admin API #off with Unique Foreign #unique", function()
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down Expand Up @@ -1123,7 +1123,7 @@ describe("Admin API #off worker_consistency=eventual", function()
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/04-admin_api/18-worker-events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/04-admin_api/19-vaults_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
18 changes: 9 additions & 9 deletions spec/02-integration/05-proxy/04-plugins_triggering_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ for _, strategy in helpers.each_strategy() do

lazy_teardown(function()
if proxy_client then proxy_client:close() end
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

it("checks global configuration without credentials", function()
Expand Down Expand Up @@ -312,7 +312,7 @@ for _, strategy in helpers.each_strategy() do
proxy_client:close()
end

helpers.stop_kong(nil, true)
helpers.stop_kong()
db:truncate("routes")
db:truncate("services")
db:truncate("consumers")
Expand Down Expand Up @@ -405,7 +405,7 @@ for _, strategy in helpers.each_strategy() do

os.remove(FILE_LOG_PATH)

helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down Expand Up @@ -516,7 +516,7 @@ for _, strategy in helpers.each_strategy() do
proxy_client:close()
end

helpers.stop_kong(nil, true)
helpers.stop_kong()

db:truncate("routes")
db:truncate("services")
Expand Down Expand Up @@ -563,7 +563,7 @@ for _, strategy in helpers.each_strategy() do
proxy_client:close()
end

helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

it("runs without causing an internal error", function()
Expand Down Expand Up @@ -712,7 +712,7 @@ for _, strategy in helpers.each_strategy() do

lazy_teardown(function()
helpers.stop_kong("servroot2")
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)


Expand Down Expand Up @@ -1073,7 +1073,7 @@ for _, strategy in helpers.each_strategy() do
proxy_client:close()
end

helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

it("is executed", function()
Expand Down Expand Up @@ -1147,7 +1147,7 @@ for _, strategy in helpers.each_strategy() do
admin_client:close()
end

helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

it("is executed", function()
Expand Down Expand Up @@ -1227,7 +1227,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

it("certificate phase clears context, fix #7054", function()
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/05-proxy/09-websockets_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

local function open_socket(uri)
Expand Down
6 changes: 3 additions & 3 deletions spec/02-integration/05-proxy/11-handler_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ for _, strategy in helpers.each_strategy() do

lazy_teardown(function()
if admin_client then admin_client:close() end
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

it("runs", function()
Expand Down Expand Up @@ -101,7 +101,7 @@ for _, strategy in helpers.each_strategy() do

lazy_teardown(function()
if admin_client then admin_client:close() end
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

it("doesn't run", function()
Expand Down Expand Up @@ -175,7 +175,7 @@ for _, strategy in helpers.each_strategy() do

lazy_teardown(function()
if admin_client then admin_client:close() end
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

it("doesn't run", function()
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/05-proxy/13-error_handlers_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("Proxy error handlers", function()
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe("#postgres upstream keepalive", function()
proxy_client:close()
end

helpers.stop_kong(nil, true)
helpers.stop_kong()
end)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong("servroot1", true)
helpers.stop_kong("servroot2", true)
helpers.stop_kong("servroot1")
helpers.stop_kong("servroot2")
end)

before_each(function()
Expand Down Expand Up @@ -1110,8 +1110,8 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong("servroot1", true)
helpers.stop_kong("servroot2", true)
helpers.stop_kong("servroot1")
helpers.stop_kong("servroot2")
end)

before_each(function()
Expand Down Expand Up @@ -1256,8 +1256,8 @@ for _, strategy in helpers.each_strategy() do
end)

lazy_teardown(function()
helpers.stop_kong("servroot1", true)
helpers.stop_kong("servroot2", true)
helpers.stop_kong("servroot1")
helpers.stop_kong("servroot2")
end)

before_each(function()
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/11-dbless/01-respawn_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ describe("worker respawn", function()
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(function()
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/11-dbless/02-workers_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe("Workers initialization #off", function()
lazy_teardown(function()
admin_client:close()
proxy_client:close()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

it("restarts worker correctly without issues on the init_worker phase when config includes 1000+ plugins", function()
Expand Down
2 changes: 1 addition & 1 deletion spec/03-plugins/19-hmac-auth/04-invalidations_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ for _, strategy in helpers.each_strategy() do
admin_client:close()
end

helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

local function hmac_sha1_binary(secret, data)
Expand Down
2 changes: 1 addition & 1 deletion spec/03-plugins/20-ldap-auth/02-invalidations_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ for _, ldap_strategy in pairs(ldap_strategies) do
end)

lazy_teardown(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

local function cache_key(conf, username, password)
Expand Down
2 changes: 1 addition & 1 deletion spec/03-plugins/23-rate-limiting/03-api_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ for _, strategy in helpers.each_strategy() do
admin_client:close()
end

helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

describe("POST", function()
Expand Down
Loading

0 comments on commit 5308d9e

Please sign in to comment.