Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(test): busted script support system trusted certificate store #12770

Merged
merged 2 commits into from
Apr 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion bin/busted
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@ setmetatable(_G, nil)

local pl_path = require("pl.path")

local cert_path = pl_path.abspath("spec/fixtures/kong_spec.crt")
local pl_file = require("pl.file")

local tools_system = require("kong.tools.system")

local cert_path do
local busted_cert_file = pl_path.tmpname()
local busted_cert_content = pl_file.read("spec/fixtures/kong_spec.crt")

local system_cert_path, err = tools_system.get_system_trusted_certs_filepath()
if system_cert_path then
busted_cert_content = busted_cert_content .. "\n" .. pl_file.read(system_cert_path)
end

pl_file.write(busted_cert_file, busted_cert_content)
cert_path = busted_cert_file
end

local DEFAULT_RESTY_FLAGS=string.format(" -c 4096 --http-conf 'lua_ssl_trusted_certificate %s;' ", cert_path)

Expand Down
Loading