diff --git a/src/charm.py b/src/charm.py index 38d083f..e8cf986 100755 --- a/src/charm.py +++ b/src/charm.py @@ -100,6 +100,9 @@ def main(self, event): # than an environment variable, but we cannot use that using podspec. # (see https://stackoverflow.com/questions/37317003/restart-pods-when-configmap-updates-in-kubernetes/51421527#51421527) # noqa E403 "configmap-hash": configmap_hash, + # To allow public access without authentication for prometheus + # metrics set environment as follows. + "MINIO_PROMETHEUS_AUTH_TYPE": "public", }, "volumeConfig": [ { diff --git a/tests/integration/test_charm.py b/tests/integration/test_charm.py index 7ec50b7..79c2e48 100644 --- a/tests/integration/test_charm.py +++ b/tests/integration/test_charm.py @@ -269,6 +269,12 @@ async def test_prometheus_grafana_integration(ops_test: OpsTest): assert response_metric["juju_application"] == APP_NAME assert response_metric["juju_model"] == ops_test.model_name + # Assert the unit is available by checking the query result + # The data is presented as a list [1707357912.349, '1'], where the + # first value is a timestamp and the second value is the state of the unit + # 1 means available, 0 means unavailable + assert response["data"]["result"][0]["value"][1] == "1" + # Helper to retry calling a function over 30 seconds or 5 attempts retry_for_5_attempts = Retrying(