From 45368686d218c48be158126b710759ee745b4ab6 Mon Sep 17 00:00:00 2001 From: Ibrahim Awwad Date: Mon, 8 Jan 2024 17:57:27 +0200 Subject: [PATCH] Hardcoding the root_dir to match the worker charm (#26) * hardcoding the root_dir to match the worker charm * fixing path in unit tests --- src/mimir_coordinator.py | 2 +- tests/unit/test_config.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/mimir_coordinator.py b/src/mimir_coordinator.py index e2214b0..ff17945 100644 --- a/src/mimir_coordinator.py +++ b/src/mimir_coordinator.py @@ -58,7 +58,7 @@ def __init__( tls_requirer: Any = None, # TODO: use and import s3 requirer obj s3_requirer: Any = None, - root_data_dir: Path = Path("/etc/mimir"), + root_data_dir: Path = Path("/data"), ): self._cluster_provider = cluster_provider self._s3_requirer = s3_requirer # type: ignore diff --git a/tests/unit/test_config.py b/tests/unit/test_config.py index a8df5a2..165ce36 100644 --- a/tests/unit/test_config.py +++ b/tests/unit/test_config.py @@ -16,35 +16,35 @@ def setUp(self): def test_build_alertmanager_config(self): alertmanager_config = self.coordinator._build_alertmanager_config() - expected_config = {"data_dir": "/etc/mimir/data-alertmanager"} + expected_config = {"data_dir": "/data/data-alertmanager"} self.assertEqual(alertmanager_config, expected_config) def test_build_alertmanager_storage_config(self): alertmanager_storage_config = self.coordinator._build_alertmanager_storage_config() - expected_config = {"filesystem": {"dir": "/etc/mimir/data-alertmanager-recovery"}} + expected_config = {"filesystem": {"dir": "/data/data-alertmanager-recovery"}} self.assertEqual(alertmanager_storage_config, expected_config) def test_build_compactor_config(self): compactor_config = self.coordinator._build_compactor_config() - expected_config = {"data_dir": "/etc/mimir/data-compactor"} + expected_config = {"data_dir": "/data/data-compactor"} self.assertEqual(compactor_config, expected_config) def test_build_ruler_config(self): ruler_config = self.coordinator._build_ruler_config() - expected_config = {"rule_path": "/etc/mimir/data-ruler"} + expected_config = {"rule_path": "/data/data-ruler"} self.assertEqual(ruler_config, expected_config) def test_build_ruler_storage_config(self): ruler_storage_config = self.coordinator._build_ruler_storage_config() - expected_config = {"filesystem": {"dir": "/etc/mimir/rules"}} + expected_config = {"filesystem": {"dir": "/data/rules"}} self.assertEqual(ruler_storage_config, expected_config) def test_build_blocks_storage_config(self): blocks_storage_config = self.coordinator._build_blocks_storage_config() expected_config = { - "bucket_store": {"sync_dir": "/etc/mimir/tsdb-sync"}, - "filesystem": {"dir": "/etc/mimir/blocks"}, - "tsdb": {"dir": "/etc/mimir/tsdb"}, + "bucket_store": {"sync_dir": "/data/tsdb-sync"}, + "filesystem": {"dir": "/data/blocks"}, + "tsdb": {"dir": "/data/tsdb"}, } self.assertEqual(blocks_storage_config, expected_config) @@ -91,7 +91,7 @@ def test_build_s3_storage_config(self): self.assertEqual(s3_storage_config, expected_config) def test_update_s3_storage_config(self): - storage_config = {"filesystem": {"dir": "/etc/mimir/blocks"}} + storage_config = {"filesystem": {"dir": "/data/blocks"}} self.coordinator._update_s3_storage_config(storage_config, "blocks") expected_config = {"storage_prefix": "blocks"} self.assertEqual(storage_config, expected_config)