diff --git a/src/grafana_agent.py b/src/grafana_agent.py index 92338e8..95aa11c 100644 --- a/src/grafana_agent.py +++ b/src/grafana_agent.py @@ -126,6 +126,7 @@ def __new__(cls, *args: Any, **kwargs: Dict[Any, Any]): def __init__(self, *args): super().__init__(*args) + os.umask(0o077) # Property to facilitate centralized status update self.status = CompoundStatus() @@ -133,13 +134,13 @@ def __init__(self, *args): charm_root = self.charm_dir.absolute() self.loki_rules_paths = RulesMapping( # TODO how to inject topology only for this charm's own rules? - # FIXED: this is already handled by re-using the *Rules classes + # FIXED: this is already handled by reusing the *Rules classes src=charm_root.joinpath(*LOKI_RULES_SRC_PATH.split("/")), dest=charm_root.joinpath(*LOKI_RULES_DEST_PATH.split("/")), ) self.metrics_rules_paths = RulesMapping( # TODO how to inject topology only for this charm's own rules? - # FIXED: this is already handled by re-using the *Rules classes + # FIXED: this is already handled by reusing the *Rules classes src=charm_root.joinpath(*METRICS_RULES_SRC_PATH.split("/")), dest=charm_root.joinpath(*METRICS_RULES_DEST_PATH.split("/")), ) diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py new file mode 100644 index 0000000..6cf36bc --- /dev/null +++ b/tests/unit/conftest.py @@ -0,0 +1,12 @@ +from unittest.mock import patch + +import pytest + + +@pytest.fixture(autouse=True) +def patch_buffer_file_for_charm_tracing(tmp_path): + with patch( + "charms.tempo_coordinator_k8s.v0.charm_tracing.BUFFER_DEFAULT_CACHE_FILE_NAME", + str(tmp_path / "foo.json"), + ): + yield