diff --git a/bin/busted b/bin/busted index 9dc511f2f222..15257648df08 100755 --- a/bin/busted +++ b/bin/busted @@ -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)