Skip to content

Commit

Permalink
add symlink test case
Browse files Browse the repository at this point in the history
  • Loading branch information
flrgh committed Jul 24, 2024
1 parent 7387299 commit d6d5c37
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions spec/02-integration/02-cmd/02-start_stop_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,46 @@ describe("kong start/stop #" .. strategy, function()
end)
end)

describe("runtime_prefix", function()
it("is created on demand by `kong prepare`", function()
local dir, cleanup = helpers.make_temp_dir()
finally(cleanup)

local cmd = fmt("prepare -p %q", dir)
assert.truthy(kong_exec(cmd), "expected '" .. cmd .. "' to succeed")
assert.truthy(helpers.path.isdir(dir .. "/runtime"),
"expected '" .. dir .. "/runtime' directory to be created")
end)

it("can be a user-created symlink", function()
local prefix, cleanup = helpers.make_temp_dir()
finally(cleanup)

local runtime_prefix
runtime_prefix, cleanup = helpers.make_temp_dir()
finally(cleanup)

assert.truthy(helpers.execute(fmt("ln -sf %q %q/runtime", runtime_prefix, prefix)),
"failed to symlink runtime prefix")

local preserve_prefix = true
assert(helpers.start_kong({
prefix = prefix,
database = "off",
nginx_conf = "spec/fixtures/custom_nginx.template",
}, nil, preserve_prefix))

finally(function()
helpers.stop_kong(prefix)
end)

wait_until_healthy(prefix)

assert.truthy(helpers.path.exists(runtime_prefix .. "/worker_events.sock"),
"worker events socket was not created in the runtime_prefix dir")
end)
end)

describe("dangling socket cleanup", function()
local pidfile = TEST_CONF.nginx_pid

Expand Down

0 comments on commit d6d5c37

Please sign in to comment.