File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -488,3 +488,41 @@ retry counter: 5
488488
489489--- error_log
490490set more tries: reduced tries due to limit
491+
492+
493+
494+ === TEST 16: set_more_tries bugfix
495+ --- http_config
496+ lua_package_path "../lua-resty-core/lib/?.lua;;";
497+ proxy_next_upstream_tries 0;
498+ upstream backend {
499+ server 0.0.0.1;
500+ balancer_by_lua_block {
501+ local balancer = require "ngx.balancer"
502+ local ctx = ngx.ctx
503+ if not ctx.has_run then
504+ ctx.has_run = true
505+ local _, err = balancer.set_more_tries(3)
506+ if err then
507+ ngx.log(ngx.ERR, "failed to set more tries: ", err)
508+ end
509+ end
510+ balancer.set_current_peer("127.0.0.1", 81)
511+ }
512+ }
513+ --- config
514+ location = /t {
515+ proxy_pass http://backend;
516+ }
517+ --- request
518+ GET /t
519+ --- error_code: 502
520+ --- grep_error_log eval: qr/http next upstream, \d+/
521+ --- grep_error_log_out
522+ http next upstream, 2
523+ http next upstream, 2
524+ http next upstream, 2
525+ http next upstream, 2
526+ --- no_error_log
527+ failed to set more tries: reduced tries due to limit
528+ [alert]
You can’t perform that action at this time.
0 commit comments