From c009c92da0fd77627baf5a490d5525228bf51bee Mon Sep 17 00:00:00 2001 From: xiaoxuanzi Date: Mon, 30 Jan 2023 12:19:32 +0800 Subject: [PATCH] add a test to show that different endpoints will be chosen randomly --- t/plugin/elasticsearch-logger.t | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/t/plugin/elasticsearch-logger.t b/t/plugin/elasticsearch-logger.t index 8d461fdaac96..e809b2f96b36 100644 --- a/t/plugin/elasticsearch-logger.t +++ b/t/plugin/elasticsearch-logger.t @@ -551,3 +551,32 @@ PTQvJEaPcNOXcOHeErC0XQ== } --- response_body passed + + + +=== TEST 14: to show that different endpoints will be chosen randomly +--- config + location /t { + content_by_lua_block { + local t = require("lib.test_admin").test + for i = 1, 10 do + local code, body = t('/hello', ngx.HTTP_GET) + ngx.say("code: ", code) + end + + } + } +--- response_body +code: 200 +code: 200 +code: 200 +code: 200 +code: 200 +code: 200 +code: 200 +code: 200 +code: 200 +code: 200 +--- error_log +http://127.0.0.1:9200/_bulk +http://127.0.0.1:9201/_bulk