Skip to content

Commit

Permalink
chore(test): busted script support system trusted certificate store
Browse files Browse the repository at this point in the history
  • Loading branch information
windmgc committed Mar 21, 2024
1 parent ed0b96d commit c6141bd
Showing 1 changed file with 16 additions and 1 deletion.
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 .. 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

0 comments on commit c6141bd

Please sign in to comment.