shreemaan-abhishek commented on code in PR #11117:
URL: https://github.com/apache/apisix/pull/11117#discussion_r1555878897
##########
t/plugin/prometheus4.t:
##########
@@ -277,3 +277,140 @@
apisix_http_latency_bucket\{type="upstream",route="1",service="",consumer="",nod
apisix_http_latency_bucket\{type="upstream",route="1",service="",consumer="",node="127.0.0.1",le="105"\}
\d+
apisix_http_latency_bucket\{type="upstream",route="1",service="",consumer="",node="127.0.0.1",le="205"\}
\d+
apisix_http_latency_bucket\{type="upstream",route="1",service="",consumer="",node="127.0.0.1",le="505"\}
\d+/
+
+
+
+=== TEST 10: set sys plugins
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+ local code, body = t('/apisix/admin/routes/9',
+ ngx.HTTP_PUT,
+ [[{
+ "methods": ["GET"],
+ "plugins": {
+ "prometheus": {},
+ "syslog": {
+ "host": "127.0.0.1",
+ "include_req_body": false,
+ "max_retry_times": 1,
+ "tls": false,
+ "retry_interval": 1,
+ "batch_max_size": 1000,
+ "buffer_duration": 60,
+ "port": 1000,
+ "name": "sys-logger",
+ "flush_limit": 4096,
+ "sock_type": "tcp",
+ "timeout": 3,
+ "drop_limit": 1048576,
+ "pool_size": 5
+ }
+ },
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:1980": 1
+ },
+ "type": "roundrobin"
+ },
+ "uri": "/batch-process-metrics"
+ }]]
+ )
+ if code >= 300 then
+ ngx.status = code
+ end
+ ngx.say(body)
+ }
+ }
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 11: remove prometheus -> reload -> send batch request -> add
prometheus for next tests
+--- config
+ location /t {
+ content_by_lua_block {
+ local http = require "resty.http"
+ local httpc = http.new()
+
+ local t = require("lib.test_admin").test
+ ngx.sleep(0.1)
+ local data = [[
+deployment:
+ role: traditional
+ role_traditional:
+ config_provider: etcd
+ admin:
+ admin_key: null
+apisix:
+ node_listen: 1984
+plugins:
+ - example-plugin
+plugin_attr:
+ example-plugin:
+ val: 1
+ ]]
+ require("lib.test_admin").set_config_yaml(data)
+ local code, _, org_body = t('/v1/plugins/reload', ngx.HTTP_PUT)
+ local code, body = t('/batch-process-metrics',
+ ngx.HTTP_GET
+ )
+
+ ngx.status = code
Review Comment:
not sure I copied this test from here:
https://github.com/apache/apisix/blob/e36db170f7e7d3ca0901bedd66ff175f55557250/t/plugin/prometheus2.t#L337C1-L389C20
😬
I tried to find the reason but could not.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]