Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tests/test_asyncio/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,24 @@ async def test_only_pass_without_creds_provider(

assert await r2.ping() is True

@pytest.mark.onlynoncluster
async def test_resp3_auth_with_health_check(
self, r_required_pass_teardown, create_valkey
):
password = "password"
r = r_required_pass_teardown(password)
await init_required_pass(r, password)
assert await r.auth(password) is True

r2 = await create_valkey(
flushdb=False,
password=password,
protocol=3,
health_check_interval=10,
)

assert await r2.ping() is True

async def test_user_and_pass_without_creds_provider(
self, r_acl_teardown, create_valkey
):
Expand Down
17 changes: 17 additions & 0 deletions tests/test_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,23 @@ def test_only_pass_without_creds_provider(self, r, request):

assert r2.ping() is True

@pytest.mark.onlynoncluster
def test_resp3_auth_with_health_check(self, r, request):
password = "password"
init_required_pass(r, request, password)
assert r.auth(password) is True

r2 = _get_client(
valkey.Valkey,
request,
flushdb=False,
password=password,
protocol=3,
health_check_interval=10,
)

assert r2.ping() is True

def test_user_and_pass_without_creds_provider(self, r, request):
"""
Test backward compatibility with username and password
Expand Down
6 changes: 5 additions & 1 deletion valkey/asyncio/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,11 @@ async def on_connect(self) -> None:
self._parser.on_connect(self)
if len(auth_args) == 1:
auth_args = ["default", auth_args[0]]
await self.send_command("HELLO", self.protocol, "AUTH", *auth_args)
# avoid checking health here -- PING will fail if we try
# to check the health prior to the AUTH
await self.send_command(
"HELLO", self.protocol, "AUTH", *auth_args, check_health=False
)
response = await self.read_response()
if response.get(b"proto") != int(self.protocol) and response.get(
"proto"
Expand Down
6 changes: 5 additions & 1 deletion valkey/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,11 @@ def on_connect(self):
self._parser.on_connect(self)
if len(auth_args) == 1:
auth_args = ("default", auth_args[0])
self.send_command("HELLO", self.protocol, "AUTH", *auth_args)
# avoid checking health here -- PING will fail if we try
# to check the health prior to the AUTH
self.send_command(
"HELLO", self.protocol, "AUTH", *auth_args, check_health=False
)
response = self.read_response()
# if response.get(b"proto") != self.protocol and response.get(
# "proto"
Expand Down
Loading