@@ -175,3 +175,42 @@ location /t {
175175GET / t
176176-- - no_error_log
177177[error]
178+
179+
180+ === TEST 5 : regression for slave sorting (iss12)
181+ -- - http_config eval: $::HttpConfig
182+ -- - config
183+ location / t {
184+ lua_socket_log_errors Off;
185+ content_by_lua_block {
186+ local rc = require (" resty.redis.connector" ). new ()
187+
188+ local params = {
189+ sentinels = {
190+ { host = " 127.0.0.1" , port = 6381 },
191+ { host = " 127.0.0.1" , port = 6382 },
192+ { host = " 127.0.0.1" , port = 6383 },
193+ },
194+ master_name = " mymaster" ,
195+ role = " slave" ,
196+ }
197+
198+ -- hotwire get_slaves to expose sorting issue
199+ local sentinel = require (" resty.redis.sentinel" )
200+ sentinel. get_slaves = function()
201+ return {
202+ { host = " 127.0.0.1" , port = 6380 },
203+ { host = " 127.0.0.1" , port = 6378 },
204+ { host = " 127.0.0.1" , port = 6377 },
205+ { host = " 134.123.51.2" , port = 6380 },
206+ }
207+ end
208+
209+ local redis, err = rc: connect_via_sentinel(params)
210+ assert(redis and not err, " redis should connect without error" )
211+ }
212+ }
213+ -- - request
214+ GET / t
215+ -- - no_error_log
216+ [error]
0 commit comments