Skip to content

Commit

Permalink
spec/01-unit/03-conf_loader_spec.lua
Browse files Browse the repository at this point in the history
  • Loading branch information
chronolaw committed Nov 27, 2023
1 parent 400da70 commit 853df3f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions spec/01-unit/03-conf_loader_spec.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local kong_meta = require "kong.meta"
local conf_loader = require "kong.conf_loader"
local utils = require "kong.tools.utils"
local helpers = require "spec.helpers"
Expand All @@ -15,6 +16,11 @@ ffi.cdef([[
]])


local KONG_VERSION = string.format("%d.%d",
kong_meta._VERSION_TABLE.major,
kong_meta._VERSION_TABLE.minor)


local function kong_user_group_exists()
if C.getpwnam("kong") == nil or C.getgrnam("kong") == nil then
return false
Expand Down Expand Up @@ -67,7 +73,7 @@ describe("Configuration loader", function()
assert.same(nil, conf.privileged_agent)
assert.same(true, conf.dedicated_config_processing)
assert.same(false, conf.allow_debug_header)
assert.matches("%d+%.%d+", conf.lmdb_validation_tag)
assert.same(KONG_VERSION, conf.lmdb_validation_tag)
assert.is_nil(getmetatable(conf))
end)
it("loads a given file, with higher precedence", function()
Expand All @@ -85,7 +91,7 @@ describe("Configuration loader", function()
assert.same({"127.0.0.1:9001"}, conf.admin_listen)
assert.same({"0.0.0.0:9000", "0.0.0.0:9443 http2 ssl",
"0.0.0.0:9002 http2"}, conf.proxy_listen)
assert.matches("%d+%.%d+", conf.lmdb_validation_tag)
assert.same(KONG_VERSION, conf.lmdb_validation_tag)
assert.is_nil(getmetatable(conf))
end)
it("preserves default properties if not in given file", function()
Expand Down

0 comments on commit 853df3f

Please sign in to comment.