From 91d9c43c42b1cfb727beaa66ab07d1995aeeb492 Mon Sep 17 00:00:00 2001 From: Abhishek Choudhary Date: Fri, 27 Sep 2024 13:49:31 +0545 Subject: [PATCH] test --- apisix/plugins/splunk-hec-logging.lua | 1 + t/plugin/splunk-hec-logging.t | 37 +++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/apisix/plugins/splunk-hec-logging.lua b/apisix/plugins/splunk-hec-logging.lua index 95aa7c739d97..c93b2736eeea 100644 --- a/apisix/plugins/splunk-hec-logging.lua +++ b/apisix/plugins/splunk-hec-logging.lua @@ -148,6 +148,7 @@ local function send_to_splunk(conf, entries) method = "POST", body = table_concat(t), headers = request_headers, + keepalive_timeout = conf.endpoint.keepalive_timeout }) if not res then diff --git a/t/plugin/splunk-hec-logging.t b/t/plugin/splunk-hec-logging.t index 068b5727fede..3d6b108f2de7 100644 --- a/t/plugin/splunk-hec-logging.t +++ b/t/plugin/splunk-hec-logging.t @@ -426,3 +426,40 @@ passed tail -n 1 ci/pod/vector/splunk.log --- response_body eval qr/.*test batched data.*/ + + + +=== TEST 13: set route with keepalive_timeout (success write) +--- config + location /t { + content_by_lua_block { + local t = require("lib.test_admin").test + local code, body = t('/apisix/admin/routes/1', ngx.HTTP_PUT, { + uri = "/hello", + upstream = { + type = "roundrobin", + nodes = { + ["127.0.0.1:1980"] = 1 + } + }, + plugins = { + ["splunk-hec-logging"] = { + endpoint = { + uri = "http://127.0.0.1:18088/services/collector", + token = "BD274822-96AA-4DA6-90EC-18940FB2414C", + keepalive_timeout = 5000 + }, + batch_max_size = 1, + inactive_timeout = 1 + } + } + }) + + if code >= 300 then + ngx.status = code + end + ngx.say(body) + } + } +--- response_body +passed