File tree Expand file tree Collapse file tree 1 file changed +35
-3
lines changed
Expand file tree Collapse file tree 1 file changed +35
-3
lines changed Original file line number Diff line number Diff line change @@ -78,10 +78,9 @@ location /t {
7878 }
7979}
8080-- - request
81- GET /t
81+ GET / t
8282-- - no_error_log
8383[error]
84- --- ONLY
8584
8685
8786=== TEST 3 : Get only healthy slaves
@@ -135,11 +134,44 @@ location /t {
135134 " only 6380 should be found" )
136135
137136 r: slaveof(" 127.0.0.1" , 6379 )
137+
138138 sentinel: close()
139139 }
140140}
141141-- - request
142- GET /t
142+ GET / t
143143-- - timeout: 10
144144-- - no_error_log
145145[error]
146+
147+
148+ === TEST 4 : connector. connect_via_sentinel
149+ -- - http_config eval: $::HttpConfig
150+ -- - config
151+ location / t {
152+ content_by_lua_block {
153+ local rc = require (" resty.redis.connector" ). new ()
154+
155+ local params = {
156+ sentinels = {
157+ { host = " 127.0.0.1" , port = 6381 },
158+ { host = " 127.0.0.1" , port = 6382 },
159+ { host = " 127.0.0.1" , port = 6383 },
160+ },
161+ master_name = " mymaster" ,
162+ role = " master" ,
163+ }
164+
165+ local redis, err = rc: connect_via_sentinel(params)
166+ assert(redis and not err, " redis should connect without error" )
167+
168+ params. role = " slave"
169+
170+ local redis, err = rc: connect_via_sentinel(params)
171+ assert(redis and not err, " redis should connect without error" )
172+ }
173+ }
174+ -- - request
175+ GET / t
176+ -- - no_error_log
177+ [error]
You can’t perform that action at this time.
0 commit comments