def _container_exists_in_set(self, service_name, include_exited): container = get_container_for_app_or_service(service_name, include_exited=include_exited) return bool(container)
def test_get_container_for_app_or_service_none_found( self, patch_docker_client): patch_docker_client.return_value = self.fake_docker_client result = get_container_for_app_or_service('app-c') self.assertIsNone(result)
def test_get_container_for_app_or_service_none_found_with_raise( self, patch_docker_client): patch_docker_client.return_value = self.fake_docker_client with self.assertRaises(RuntimeError): get_container_for_app_or_service('app-c', raise_if_not_found=True)
def test_get_container_for_app_or_service_none_found_with_raise(self): with self.assertRaises(RuntimeError): get_container_for_app_or_service(self.fake_docker_client, 'app-c', raise_if_not_found=True)
def test_get_container_for_app_or_service(self, patch_docker_client): patch_docker_client.return_value = self.fake_docker_client result = get_container_for_app_or_service('app-a') self.assertIn('/dusty_app-a_1', result['Names'])
def exec_in_container(self, service_name, command): client = get_docker_client() container = get_container_for_app_or_service(client, service_name, raise_if_not_found=True) return exec_in_container(client, container, *command.split(' '))
def test_get_container_for_app_or_service_none_found(self): result = get_container_for_app_or_service(self.fake_docker_client, 'app-c') self.assertIsNone(result)
def exec_in_container(self, service_name, command): container = get_container_for_app_or_service(service_name, raise_if_not_found=True) return exec_in_container(container, *command.split(" "))
def container_id(self, service_name): return get_container_for_app_or_service(service_name, include_exited=True, raise_if_not_found=True)["Id"]
def test_get_container_for_app_or_service_none_found_with_raise(self, patch_docker_client): patch_docker_client.return_value = self.fake_docker_client with self.assertRaises(RuntimeError): get_container_for_app_or_service('app-c', raise_if_not_found=True)
def test_get_container_for_app_or_service_none_found(self, patch_docker_client): patch_docker_client.return_value = self.fake_docker_client result = get_container_for_app_or_service('app-c') self.assertIsNone(result)
def container_id(self, service_name): client = get_docker_client() return get_container_for_app_or_service(client, service_name, include_exited=True, raise_if_not_found=True)['Id']
def exec_in_container(self, service_name, command): container = get_container_for_app_or_service(service_name, raise_if_not_found=True) return exec_in_container(container, *command.split(' '))
def test_get_container_for_app_or_service(self): result = get_container_for_app_or_service(self.fake_docker_client, 'app-a') self.assertIn('/dusty_app-a_1', result['Names'])
def container_id(self, service_name): return get_container_for_app_or_service(service_name, include_exited=True, raise_if_not_found=True)['Id']
def _container_exists_in_set(self, service_name, include_exited): client = get_docker_client() container = get_container_for_app_or_service(client, service_name, include_exited=include_exited) return bool(container)