Skip to content

Commit

Permalink
add test for clickhouse-logger to show that different endpoints will …
Browse files Browse the repository at this point in the history
…be chosen randomly
  • Loading branch information
xiaoxuanzi committed Feb 2, 2023
1 parent 0e2b925 commit be04c7c
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion t/plugin/clickhouse-logger.t
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,38 @@ passed
=== TEST 6: access local server
=== TEST 6: to show that different endpoints will be chosen randomly
--- config
location /t {
content_by_lua_block {
local code_count = {}
local t = require("lib.test_admin").test
for i = 1, 12 do
local code, body = t('/opentracing', ngx.HTTP_GET)
if code ~= 200 then
ngx.say("code: ", code, " body: ", body)
end
code_count[code] = (code_count[code] or 0) + 1
end
local code_arr = {}
for code, count in pairs(code_count) do
table.insert(code_arr, {code = code, count = count})
end
ngx.say(require("toolkit.json").encode(code_arr))
ngx.exit(200)
}
}
--- response_body
[{"code":200,"count":12}]
--- error_log
sending a batch logs to http://127.0.0.1:1980/clickhouse_logger_server
sending a batch logs to http://127.0.0.1:10420/clickhouse-logger/test1
=== TEST 7: access local server
--- request
GET /opentracing
--- response_body
Expand Down

0 comments on commit be04c7c

Please sign in to comment.