'Test cleanup resilience in the face of exceptions.'

def test_cleanup_incomplete_backup_operations_with_exceptions(self):

    fake_backup_list = [{'id': str(uuid.uuid4())}, {'id': str(uuid.uuid4())}, {'id': str(uuid.uuid4())}]
    mock_backup_get_by_host = self.mock_object(objects.BackupList, 'get_all_by_host')
    mock_backup_get_by_host.return_value = fake_backup_list
    mock_backup_cleanup = self.mock_object(self.backup_mgr, '_cleanup_one_backup')
    mock_backup_cleanup.side_effect = [Exception]
    mock_temp_cleanup = self.mock_object(self.backup_mgr, '_cleanup_temp_volumes_snapshots_for_one_backup')
    mock_temp_cleanup.side_effect = [Exception]
    self.assertIsNone(self.backup_mgr._cleanup_incomplete_backup_operations(self.ctxt))
    self.assertEqual(len(fake_backup_list), mock_backup_cleanup.call_count)
    self.assertEqual(len(fake_backup_list), mock_temp_cleanup.call_count)
