Skip to content

Commit

Permalink
fix: do not query for non-existent buckets in healthz
Browse files Browse the repository at this point in the history
This yields a routing problem with reverse proxies. Now we're checking
for the configured bucket, which makes more sense anyway.
  • Loading branch information
open-dynaMIX committed Feb 8, 2024
1 parent adc3ff1 commit 7d5e8ab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion caluma/caluma_core/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def db_broken_connection(transactional_db):
def minio_mock_working(mocker):
"""Provide working minio mock for health checks."""
return mocker.patch.object(
storage_clients.client.client, "bucket_exists", return_value=False
storage_clients.client.client, "bucket_exists", return_value=True
)


Expand Down
8 changes: 5 additions & 3 deletions caluma/caluma_core/health_checks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from io import StringIO
from uuid import uuid4

from django.conf import settings
from django.core import management
Expand Down Expand Up @@ -28,8 +27,11 @@ def _check_pending_migrations(db_name):
@check
def _check_media_storage_service():
"""Check media storage service connectivity."""
assert not storage_clients.client.client.bucket_exists(str(uuid4()))
return {"ok": True}
return {
"ok": storage_clients.client.client.bucket_exists(
settings.MEDIA_STORAGE_BUCKET_NAME
)
}


def check_media_storage_service():
Expand Down

0 comments on commit 7d5e8ab

Please sign in to comment.