Strengthen is_connected with cached health probes.
Code Quality Pipeline / code-quality (pull_request) Failing after 35s
PR Title Check / check-title (pull_request) Successful in 6s
Test Python Package / test (pull_request) Successful in 1m9s

Convert is_connected to a method that verifies backend liveness via TTL-cached ping (Redis) or bucket_exists (MinIO), with cache invalidation on connect/disconnect.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Brian Bjarke Jensen
2026-07-05 15:28:25 +02:00
co-authored by Cursor
parent fef9552cbf
commit 5149299c1b
8 changed files with 289 additions and 34 deletions
+3 -3
View File
@@ -115,7 +115,7 @@ def test_should_have_logger_when_instantiated() -> None:
def test_should_not_be_connected_when_instantiated() -> None:
"""Test that the MinioAdapter is not connected when instantiated."""
adapter = MinioAdapter()
assert not adapter.is_connected
assert not adapter.is_connected()
def test_should_log_info_when_already_connected(
@@ -137,7 +137,7 @@ def test_should_raise_connection_error_when_unable_to_connect(
adapter = MinioAdapter()
with pytest.raises(ConnectionError):
adapter.connect()
assert not adapter.is_connected
assert not adapter.is_connected()
def test_should_log_info_when_creating_expected_bucket(
@@ -163,7 +163,7 @@ def test_should_log_error_on_exception_during_exit(
"""Test that the MinioAdapter logs an error if an exception occurs during __exit__."""
try:
with MinioAdapter() as adapter:
assert adapter.is_connected
assert adapter.is_connected()
raise ValueError("Simulated error")
except ValueError:
pass # Expected