Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions nova/tests/unit/compute/test_compute_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -7615,6 +7615,24 @@ def test_validate_instance_group_policy_handles_hint_list(self, mock_get):
instance, hints)
mock_get.assert_called_once_with(self.context, uuids.group_hint)

@mock.patch('nova.objects.InstanceGroup.get_by_hint')
def test_validate_instance_group_policy_deleted_group(self, mock_get):
"""Tests that _validate_instance_group_policy handles the case
where the scheduler hint has a group but that group has been deleted.
This tests is a reproducer for bug: #1890244
"""
instance = objects.Instance(uuid=uuids.instance)
hints = {'group': [uuids.group_hint]}
mock_get.side_effect = exception.InstanceGroupNotFound(
group_uuid=uuids.group_hint
)
# FIXME(sean-k-mooney): this should not leak the exception
self.assertRaises(
exception.InstanceGroupNotFound,
self.compute._validate_instance_group_policy, self.context,
instance, hints)
mock_get.assert_called_once_with(self.context, uuids.group_hint)

@mock.patch('nova.objects.InstanceGroup.get_by_uuid')
@mock.patch('nova.objects.InstanceList.get_uuids_by_host')
@mock.patch('nova.objects.InstanceGroup.get_by_hint')
Expand Down