Skip to content

Commit

Permalink
add test for error-log-logger
Browse files Browse the repository at this point in the history
  • Loading branch information
shreemaan-abhishek committed May 22, 2023
1 parent f6d9a7e commit 03c8ed3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions t/plugin/error-log-logger-skywalking.t
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,34 @@ qr/.*\[\{\"body\":\{\"text\":\{\"text\":\".*this is an info message for test.*\"
GET /tg
--- response_body
passed
=== TEST 8: put plugin metadata with $hostname and log an error level message
--- config
location /tg {
content_by_lua_block {
local core = require("apisix.core")
local t = require("lib.test_admin").test
local code, body = t('/apisix/admin/plugin_metadata/error-log-logger',
ngx.HTTP_PUT,
[[{
"skywalking": {
"endpoint_addr": "http://127.0.0.1:1982/log",
"service_instance_name": "$hostname"
},
"batch_max_size": 15,
"inactive_timeout": 1
}]]
)
ngx.sleep(2)
core.log.error("this is an error message for test.")
}
}
--- request
GET /tg
--- response_body
--- no_error_log eval
qr/\\\"serviceInstance\\\":\\\"\$hostname\\\"/
qr/\\\"serviceInstance\\\":\\\"\\\"/
--- wait: 0.5

0 comments on commit 03c8ed3

Please sign in to comment.