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
2 changes: 1 addition & 1 deletion health_check/contrib/redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __repr__(self):
for key, value in sorted(
client.connection_pool.connection_kwargs.items()
)
if key in {"host", "db"}
if key in {"host", "port", "db"}
)
Comment thread
gabriele-v marked this conversation as resolved.
return f"Redis({safe_connection_str})"
except AttributeError:
Expand Down
3 changes: 2 additions & 1 deletion tests/contrib/test_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,13 @@ async def test_redis__validation_neither_param(self):

def test_redis__repr_standard_client(self):
"""Verify repr includes host and db for a standard Redis client."""
# https://github.com/codingjoe/django-health-check/issues/659
from redis.asyncio import Redis as RedisClient

check = RedisHealthCheck(
client_factory=lambda: RedisClient(host="myhost", port=6379, db=2)
)
assert repr(check) == "Redis(db=2, host='myhost')"
assert repr(check) == "Redis(db=2, host='myhost', port=6379)"

def test_redis__repr_from_url(self):
"""Verify repr includes host and db when client is created via from_url."""
Expand Down