import unittest from unittest.mock import patch from o11ydiagnosis.subtasks.regionscompactor import Config class MockTask: """Mock task for testing""" def __init__(self): self.env = "prod" self.provider = "aws" self.region = "us-east-1" self.serverless = False self.tenant_id = "test-tenant" self.project_id = "test-project" self.cluster_id = "test-cluster" self.cache_prefix = "./cache" class TestRegionsCompactorConfig(unittest.TestCase): def test_config_initialization(self): """Test that Config can be initialized""" mock_task = MockTask() cfg = Config(mock_task) self.assertIsNotNone(cfg) self.assertEqual(cfg.task.env, "prod") self.assertEqual(cfg.task.provider, "aws") self.assertEqual(cfg.task.region, "us-east-1") @patch('o11ydiagnosis.subtasks.regionscompactor.Config._run') def test_config_run(self, mock_run): """Test config run method""" mock_task = MockTask() cfg = Config(mock_task) # Test that _run exists and can be called self.assertTrue(hasattr(cfg, '_run')) # If _run is callable, verify it can be mocked if callable(cfg._run): cfg._run(1234567890) # If no exception, test passes if __name__ == "__main__": unittest.main()