def test_health(self, health_map): health_model = health.HealthModel(self.mock_controller, health_map) storage_name = health_map['storage']['storage_name'] self.assertEqual('true', health_model['storage'][storage_name]['online']) dns_name = health_map['dns']['dns_name'] self.assertEqual('true', health_model['dns'][dns_name]['online'])
def get(self): """Returns the health of storage and providers.""" health_controller = self._driver.manager.health_controller is_alive, health_map = health_controller.health() if not is_alive: pecan.response.status = 503 return health_response.HealthModel(self, health_map)
def test_health(self, health_map): health_model = health.HealthModel(self.mock_controller, health_map) storage_name = health_map['storage']['storage_name'] self.assertEqual('true', health_model['storage'][storage_name]['online']) dns_name = health_map['dns']['dns_name'] self.assertEqual('true', health_model['dns'][dns_name]['online']) distributed_task_name = \ health_map['distributed_task']['distributed_task_name'] status = \ health_model['distributed_task'][distributed_task_name]['online'] self.assertEqual('true', status)
def test_health_provider_not_available(self, health_map): health_model = health.HealthModel(self.mock_controller, health_map) providers = health_map['providers'] for provider in providers: provider_name = provider['provider_name'] provider_is_alive = provider['is_alive'] provider_model = health_model['providers'][provider_name] if provider_is_alive: self.assertEqual('true', provider_model['online']) else: self.assertEqual('false', provider_model['online'])
def test_health_dns_not_available(self, health_map): health_model = health.HealthModel(self.mock_controller, health_map) dns_name = health_map['dns']['dns_name'] self.assertEqual('false', health_model['dns'][dns_name]['online'])
def test_health_distributed_task_not_available(self, health_map): health_model = health.HealthModel(self.mock_controller, health_map) distributed_task = health_map['distributed_task'] distributed_task_name = distributed_task['distributed_task_name'] status = health_model['distributed_task'][distributed_task_name] self.assertEqual('false', status['online'])