Skip to content

Commit 1444629

Browse files
committed
PR feedback
1 parent f20612c commit 1444629

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/redis_client.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,11 @@ def connect
842842
end
843843
end
844844
end
845-
rescue FailoverError, CannotConnectError => error
845+
rescue FailoverError => error
846+
@raw_connection&.close
847+
error._set_config(config)
848+
raise error
849+
rescue CannotConnectError => error
846850
error._set_config(config)
847851
raise error
848852
rescue ConnectionError => error

test/shared/redis_client_tests.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -356,19 +356,21 @@ def test_authentication
356356
assert_match(/WRONGPASS invalid username-password pair/, error.message)
357357

358358
# Correct password, but user disabled
359-
backup.call("ACL", "SETUSER", "AzureDiamond", "<hunter2", ">trolilol", "off")
359+
@redis.call("ACL", "DELUSER", "AnotherUser")
360+
backup.call("ACL", "SETUSER", "AnotherUser", ">boom", "off")
361+
client = new_client(username: "AnotherUser", password: "boom")
360362
error = assert_raises RedisClient::AuthenticationError do
361363
client.call_once("PING")
362364
end
363365
assert_match(/WRONGPASS invalid username-password pair/, error.message)
364366

365367
# Correct password, user enabled
366-
backup.call("ACL", "SETUSER", "AzureDiamond", "on")
368+
backup.call("ACL", "SETUSER", "AnotherUser", "on")
367369
assert_equal "PONG", client.call_once("PING")
368370
assert_match(/user=AzureDiamond/, client.call("CLIENT", "INFO"))
369371

370372
# Wrong username
371-
client = new_client(username: "GreenOpal", password: "trolilol")
373+
client = new_client(username: "GreenOpal", password: "boom")
372374
error = assert_raises RedisClient::AuthenticationError do
373375
client.call("PING")
374376
end

0 commit comments

Comments
 (0)