Skip to content

Commit d7c8be3

Browse files
committed
test(auth) check password is sent (and fails)
1 parent adf26ba commit d7c8be3

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

t/connector.t

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ GET /t
161161
location /t {
162162
lua_socket_log_errors Off;
163163
content_by_lua_block {
164-
local rc = require("resty.redis.connector").new()
164+
local rc = require("resty.redis.connector").new({
165+
port = $TEST_NGINX_REDIS_PORT,
166+
})
165167

166168
local redis = assert(rc:connect(),
167169
"rc:connect should return positively")
@@ -186,3 +188,26 @@ location /t {
186188
GET /t
187189
--- no_error_log
188190
[error]
191+
192+
193+
=== TEST 6: password
194+
--- http_config eval: $::HttpConfig
195+
--- config
196+
location /t {
197+
lua_socket_log_errors Off;
198+
content_by_lua_block {
199+
local rc = require("resty.redis.connector").new({
200+
port = $TEST_NGINX_REDIS_PORT,
201+
password = "foo",
202+
})
203+
204+
local redis, err = rc:connect()
205+
assert(not redis and string.find(err, "ERR Client sent AUTH, but no password is set"),
206+
"connect should fail with password error")
207+
208+
}
209+
}
210+
--- request
211+
GET /t
212+
--- error_log
213+
ERR Client sent AUTH, but no password is set

0 commit comments

Comments
 (0)