Skip to content

Commit

Permalink
tests(*): remove useless strategy arg from reload_kong helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
windmgc authored and ms2008 committed Dec 6, 2024
1 parent d921983 commit 10ed044
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions spec/02-integration/02-cmd/02-start_stop_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ describe("kong start/stop #" .. strategy, function()
local body = assert.response(res).has.jsonbody()
assert.equal("no Route matched with those values", body.message)

assert(helpers.reload_kong("off", "reload --prefix " .. helpers.test_conf.prefix, {
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix, {
database = "off",
vaults = "mocksocket",
plugins = "session",
Expand Down Expand Up @@ -825,7 +825,7 @@ describe("kong start/stop #" .. strategy, function()
local body = assert.response(res).has.jsonbody()
assert.equal("no Route matched with those values", body.message)

assert(helpers.reload_kong("off", "reload --prefix " .. helpers.test_conf.prefix, {
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix, {
database = "off",
vaults = "mocksocket",
plugins = "session",
Expand Down Expand Up @@ -916,7 +916,7 @@ describe("kong start/stop #" .. strategy, function()
local body = assert.response(res).has.jsonbody()
assert.equal("no Route matched with those values", body.message)

assert(helpers.reload_kong("off", "reload --prefix " .. helpers.test_conf.prefix, {
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix, {
database = "off",
vaults = "mocksocket",
plugins = "session",
Expand Down Expand Up @@ -1005,7 +1005,7 @@ describe("kong start/stop #" .. strategy, function()
local body = assert.response(res).has.jsonbody()
assert.equal("no Route matched with those values", body.message)

assert(helpers.reload_kong("off", "reload --prefix " .. helpers.test_conf.prefix, {
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix, {
database = "off",
vaults = "mocksocket",
plugins = "session",
Expand Down
18 changes: 9 additions & 9 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()
local nginx_pid = wait_for_file_contents(helpers.test_conf.nginx_pid, 10)

-- kong_exec uses test conf too, so same prefix
assert(helpers.reload_kong(strategy, "reload --prefix " .. helpers.test_conf.prefix))
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix))

local nginx_pid_after = wait_for_file_contents(helpers.test_conf.nginx_pid, 10)

Expand Down Expand Up @@ -133,7 +133,7 @@ describe("kong reload #" .. strategy, function()
local pids_1 = json.pids
client:close()

assert(helpers.reload_kong(strategy, "reload --prefix " .. helpers.test_conf.prefix))
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix))

client = helpers.admin_client()
local res = assert(client:get("/"))
Expand Down Expand Up @@ -170,7 +170,7 @@ describe("kong reload #" .. strategy, function()
local node_id_1 = json.node_id
client:close()

assert(helpers.reload_kong(strategy, "reload --prefix " .. helpers.test_conf.prefix))
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix))

client = helpers.admin_client()
local res = assert(client:get("/"))
Expand Down Expand Up @@ -246,7 +246,7 @@ describe("kong reload #" .. strategy, function()
- example.test
]], yaml_file)

assert(helpers.reload_kong(strategy, "reload --prefix " .. helpers.test_conf.prefix, {
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix, {
declarative_config = yaml_file,
}))

Expand Down Expand Up @@ -316,7 +316,7 @@ describe("kong reload #" .. strategy, function()
return true
end)

assert(helpers.reload_kong(strategy, "reload --prefix " .. helpers.test_conf.prefix))
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix))

admin_client = assert(helpers.admin_client())
local res = assert(admin_client:send {
Expand Down Expand Up @@ -413,7 +413,7 @@ describe("kong reload #" .. strategy, function()
return true
end)

assert(helpers.reload_kong(strategy, "reload --prefix " .. helpers.test_conf.prefix))
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix))

admin_client = assert(helpers.admin_client())
local res = assert(admin_client:send {
Expand Down Expand Up @@ -504,7 +504,7 @@ describe("kong reload #" .. strategy, function()
weight: 100
]], yaml_file)

assert(helpers.reload_kong(strategy, "reload --prefix " .. helpers.test_conf.prefix, {
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix, {
declarative_config = yaml_file,
}))

Expand Down Expand Up @@ -655,7 +655,7 @@ describe("key-auth plugin invalidation on dbless reload #off", function()
keyauth_credentials:
- key: my-new-key
]], yaml_file)
assert(helpers.reload_kong("off", "reload --prefix " .. helpers.test_conf.prefix, {
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix, {
database = "off",
declarative_config = yaml_file,
}))
Expand Down Expand Up @@ -743,7 +743,7 @@ describe("Admin GUI config", function ()

client:close()

assert(helpers.reload_kong("off", "reload --conf " .. helpers.test_conf_path, {
assert(helpers.reload_kong("reload --conf " .. helpers.test_conf_path, {
database = "off",
admin_gui_listen = "127.0.0.1:9012",
admin_gui_url = "http://test2.example.com",
Expand Down
2 changes: 1 addition & 1 deletion spec/02-integration/04-admin_api/22-debug_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ describe("Admin API - Kong debug route with strategy #" .. strategy, function()
end, 3)

local prefix = helpers.test_conf.prefix
assert(helpers.reload_kong(strategy, "reload --prefix " .. prefix))
assert(helpers.reload_kong("reload --prefix " .. prefix))

-- Wait for new workers to spawn
helpers.pwait_until(function()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ describe("dbless persistence with a declarative config #off", function()
end)

it("doesn't load the persisted lmdb config if a declarative config is set on reload", function()
assert(helpers.reload_kong("off", "reload --prefix " .. helpers.test_conf.prefix, {
assert(helpers.reload_kong("reload --prefix " .. helpers.test_conf.prefix, {
database = "off",
declarative_config = yaml_file,
}))
Expand Down
6 changes: 3 additions & 3 deletions spec/internal/wait.lua
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ do
end


local function wait_until_no_common_workers(workers, expected_total, strategy)
local function wait_until_no_common_workers(workers, expected_total)
wait_until(function()
local pok, admin_client = pcall(client.admin_client)
if not pok then
Expand Down Expand Up @@ -665,11 +665,11 @@ end


--- Reload Kong and wait all workers are restarted.
local function reload_kong(strategy, ...)
local function reload_kong(...)
local workers = get_kong_workers()
local ok, err = shell.kong_exec(...)
if ok then
wait_until_no_common_workers(workers, 1, strategy)
wait_until_no_common_workers(workers, 1)
end
return ok, err
end
Expand Down

1 comment on commit 10ed044

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bazel Build

Docker image available kong/kong:10ed044c6ff3a99b4a107c7494f540f41f72c019
Artifacts available https://github.com/Kong/kong/actions/runs/12191514664

Please sign in to comment.