Skip to content

Commit

Permalink
chore(test): remove prefix directory when stop_kong called (#12691)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Water-Melon authored Mar 7, 2024
1 parent 3fe3434 commit 3dd5bdb
Show file tree
Hide file tree
Showing 46 changed files with 68 additions and 68 deletions.
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 @@ -1966,7 +1966,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
10 changes: 5 additions & 5 deletions spec/02-integration/04-admin_api/15-off_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,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 @@ -2741,7 +2741,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 @@ -2862,7 +2862,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 @@ -3005,7 +3005,7 @@ describe("Admin API #off with cache key vs endpoint key #unique", function()
end)

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

before_each(function()
Expand Down Expand Up @@ -3073,7 +3073,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
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 @@ -27,7 +27,7 @@ for _, strategy in helpers.all_strategies() 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
4 changes: 2 additions & 2 deletions spec/02-integration/04-admin_api/25-max_safe_integer_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,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 @@ -63,7 +63,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
6 changes: 3 additions & 3 deletions spec/02-integration/05-proxy/04-plugins_triggering_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,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 @@ -744,7 +744,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 @@ -1277,7 +1277,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 @@ -12,7 +12,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 @@ -125,7 +125,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 @@ -82,8 +82,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 @@ -1196,8 +1196,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 @@ -1337,8 +1337,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 @@ -57,7 +57,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
4 changes: 2 additions & 2 deletions spec/02-integration/11-dbless/03-config_persistence_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("dbless persistence #off", function()
end)

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

it("loads the lmdb config on restarts", function()
Expand Down Expand Up @@ -113,7 +113,7 @@ describe("dbless persistence with a declarative config #off", function()
end)

after_each(function()
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)
lazy_teardown(function()
os.remove(yaml_file)
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/13-vaults/05-ttl_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe("vault ttl and rotation (#" .. strategy .. ") #" .. vault.name, functio
client:close()
end

helpers.stop_kong(nil, true)
helpers.stop_kong()
vault:teardown()

helpers.unsetenv("KONG_LUA_PATH_OVERRIDE")
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/13-vaults/07-resurrect_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ describe("vault resurrect_ttl and rotation (#" .. strategy .. ") #" .. vault.nam
client:close()
end

helpers.stop_kong(nil, true)
helpers.stop_kong()
vault:teardown()

helpers.unsetenv("KONG_LUA_PATH_OVERRIDE")
Expand Down
2 changes: 1 addition & 1 deletion spec/03-plugins/01-legacy_queue_parameter_warning_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ for _, strategy in helpers.each_strategy() do
if admin_client then
admin_client:close()
end
helpers.stop_kong(nil, true)
helpers.stop_kong()
end)

before_each(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 @@ -63,7 +63,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
12 changes: 6 additions & 6 deletions spec/03-plugins/24-response-rate-limiting/04-access_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ for _, strategy in helpers.each_strategy() do
end)

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

describe("Without authentication (IP address)", function()
Expand Down Expand Up @@ -619,7 +619,7 @@ for _, strategy in helpers.each_strategy() do
end)

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

it("expires a counter", function()
Expand Down Expand Up @@ -696,7 +696,7 @@ for _, strategy in helpers.each_strategy() do
end)

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

it("blocks when the consumer exceeds their quota, no matter what service/route used", function()
Expand Down Expand Up @@ -739,7 +739,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 @@ -828,7 +828,7 @@ for _, strategy in helpers.each_strategy() do
end)

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

it("does not work if an error occurs", function()
Expand Down Expand Up @@ -930,7 +930,7 @@ for _, strategy in helpers.each_strategy() do
end)

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

it("does not work if an error occurs", function()
Expand Down
Loading

0 comments on commit 3dd5bdb

Please sign in to comment.