This is an automated email from the ASF dual-hosted git repository.
wenming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new e51bf679a fix: include stream plugins in ci (#12844)
e51bf679a is described below
commit e51bf679ab2550e585f0703bd4abb7b85e8d7bbe
Author: Shreemaan Abhishek <[email protected]>
AuthorDate: Tue Dec 30 07:52:33 2025 +0545
fix: include stream plugins in ci (#12844)
* fix: enable stream plugins
Signed-off-by: Abhishek Choudhary <[email protected]>
* fix
Signed-off-by: Abhishek Choudhary <[email protected]>
* lim conn
Signed-off-by: Abhishek Choudhary <[email protected]>
* f
Signed-off-by: Abhishek Choudhary <[email protected]>
* fix
Signed-off-by: Abhishek Choudhary <[email protected]>
* f
Signed-off-by: Nic <[email protected]>
* f
Signed-off-by: Nic <[email protected]>
---------
Signed-off-by: Abhishek Choudhary <[email protected]>
Signed-off-by: Nic <[email protected]>
Co-authored-by: Nic <[email protected]>
---
.github/workflows/build.yml | 2 +-
apisix/plugins/limit-conn/init.lua | 11 +++++------
t/stream-plugin/mqtt-proxy2.t | 3 ++-
t/stream-plugin/prometheus.t | 28 +++++++++++++++++++++++++---
t/stream-plugin/syslog.t | 5 ++---
5 files changed, 35 insertions(+), 14 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index cef6347c0..f4a6e92bd 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -33,7 +33,7 @@ jobs:
- lua-resty-events
test_dir:
- t/plugin/[a-k]*
- - t/plugin/[l-z]*
+ - t/stream-plugin t/plugin/[l-z]*
- t/admin t/cli t/config-center-yaml t/control t/core t/debug
t/discovery t/error_page t/http3/admin t/misc
- t/node t/pubsub t/router t/script t/secret t/stream-node t/utils
t/wasm t/xds-library t/xrpc
diff --git a/apisix/plugins/limit-conn/init.lua
b/apisix/plugins/limit-conn/init.lua
index d7401df9c..22ce44a12 100644
--- a/apisix/plugins/limit-conn/init.lua
+++ b/apisix/plugins/limit-conn/init.lua
@@ -41,12 +41,9 @@ local _M = {}
local function create_limit_obj(conf)
- if conf.policy == "local" then
- core.log.info("create new limit-conn plugin instance")
- return limit_conn_new(shdict_name, conf.conn, conf.burst,
- conf.default_conn_delay)
- elseif conf.policy == "redis" then
+ core.log.info("create new limit-conn plugin instance")
+ if conf.policy == "redis" then
core.log.info("create new limit-conn redis plugin instance")
return redis_single_new("plugin-limit-conn", conf, conf.conn,
conf.burst,
@@ -59,7 +56,9 @@ local function create_limit_obj(conf)
return redis_cluster_new("plugin-limit-conn", conf, conf.conn,
conf.burst,
conf.default_conn_delay)
else
- return nil, "policy enum not match"
+ core.log.info("create new limit-conn plugin instance")
+ return limit_conn_new(shdict_name, conf.conn, conf.burst,
+ conf.default_conn_delay)
end
end
diff --git a/t/stream-plugin/mqtt-proxy2.t b/t/stream-plugin/mqtt-proxy2.t
index 2e1e53efa..107d0c7fc 100644
--- a/t/stream-plugin/mqtt-proxy2.t
+++ b/t/stream-plugin/mqtt-proxy2.t
@@ -74,7 +74,7 @@ passed
"\x10\x0f\x00\x04\x4d\x51\x54\x54\x04\x02\x00\x3c\x00\x03\x66\x6f\x6f"
--- error_log
failed to parse domain: loc, error:
---- timeout: 10
+--- timeout: 25
@@ -109,6 +109,7 @@ failed to parse domain: loc, error:
}
--- request
GET /t
+--- error_code: 201
--- response_body
passed
diff --git a/t/stream-plugin/prometheus.t b/t/stream-plugin/prometheus.t
index 7c37128f4..33b037cc6 100644
--- a/t/stream-plugin/prometheus.t
+++ b/t/stream-plugin/prometheus.t
@@ -22,6 +22,11 @@ BEGIN {
$ENV{TEST_NGINX_USE_HUP} = 1;
undef $ENV{TEST_NGINX_USE_STAP};
}
+ # because nginx-lua-prometheus uses a timer to periodically synchronize
lua module variables to
+ # shared dict, and all test cases in this test file use HUP to reload
nginx in order to retain
+ # the data in the shared dict, it is necessary to increase the value of
TEST_NGINX_SLEEP to
+ # avoid losing prometheus data due to worker exits.
+ $ENV{TEST_NGINX_SLEEP} = 1;
}
use t::APISIX;
@@ -136,8 +141,25 @@ Received unexpected MQTT packet type+flags
=== TEST 5: fetch the prometheus metric data
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local core = require("apisix.core")
+ local http = require("resty.http")
+
+ ngx.sleep(2) -- wait for the metrics to be updated
+ local httpc = http.new()
+ local res, err =
httpc:request_uri("http://127.0.0.1:1984/apisix/prometheus/metrics")
+ if not res then
+ ngx.say(err)
+ return
+ end
+ ngx.say(res.body)
+ }
+ }
--- request
-GET /apisix/prometheus/metrics
+GET /t
--- response_body eval
qr/apisix_stream_connection_total\{route="mqtt"\} 2/
@@ -147,7 +169,7 @@ qr/apisix_stream_connection_total\{route="mqtt"\} 2/
--- request
GET /apisix/prometheus/metrics
--- response_body eval
-qr/apisix_nginx_http_current_connections\{state="active"\} 1/
+qr/apisix_nginx_http_current_connections\{state="active".*\} \d+/
@@ -155,4 +177,4 @@ qr/apisix_nginx_http_current_connections\{state="active"\}
1/
--- request
GET /apisix/prometheus/metrics
--- response_body eval
-qr/apisix_node_info\{hostname="[^"]+"\}/
+qr/apisix_node_info\{hostname="[^"]+".*\}/
diff --git a/t/stream-plugin/syslog.t b/t/stream-plugin/syslog.t
index 0485b0811..030b53dc5 100644
--- a/t/stream-plugin/syslog.t
+++ b/t/stream-plugin/syslog.t
@@ -149,7 +149,7 @@ mmm
hello world
--- wait: 0.5
--- error_log eval
-qr/message received:.*\"client_ip\\"\:\\"127.0.0.1\\"/
+qr/message received:.*"client_ip":"127.0.0.1"/
@@ -373,8 +373,7 @@ sending a batch logs to 127.0.0.1:5045
"127.0.0.1:1995": 1
},
"type": "roundrobin"
- },
- "uri": "/hello"
+ }
}]]
)