Skip to content

Commit

Permalink
feature(plugins/http-log): added a new configuration no_queue to in…
Browse files Browse the repository at this point in the history
…dicates whether to disable the queue mechanism.
  • Loading branch information
vm-001 committed Aug 7, 2024
1 parent 4683d93 commit 0914b62
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions spec/03-plugins/03-http-log/01-log_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ for _, strategy in helpers.each_strategy() do
http_endpoint = "http://" .. helpers.mock_upstream_host
.. ":"
.. helpers.mock_upstream_port
.. "/post_log/http_tag",
queue = {
max_batch_size = 2,
}
.. "/post_log/http_tag"
}
}

Expand Down Expand Up @@ -341,6 +338,23 @@ for _, strategy in helpers.each_strategy() do
}
}

local route1_4 = bp.routes:insert {
hosts = { "no_queue.test" },
service = service1
}

bp.plugins:insert {
route = { id = route1_4.id },
name = "http-log",
config = {
http_endpoint = "http://" .. helpers.mock_upstream_host
.. ":"
.. helpers.mock_upstream_port
.. "/post_log/http",
no_queue = true,
}
}

helpers.setenv(vault_env_name, vault_env_value)

assert(helpers.start_kong({
Expand Down Expand Up @@ -642,11 +656,11 @@ for _, strategy in helpers.each_strategy() do
admin_client:close()
end)

it("should not use queue when max_batch_size is 1", function()
it("should not use queue when no_queue is true", function()
reset_log("http")
local res = proxy_client:get("/status/200", {
headers = {
["Host"] = "http_logging.test"
["Host"] = "no_queue.test"
}
})
assert.res_status(200, res)
Expand Down

0 comments on commit 0914b62

Please sign in to comment.