Skip to content

Commit be9fe5c

Browse files
Improve prep_resize reschedule unit test
Unit test test_prep_resize_errors_migration was failing on _get_scheduler_hints instead of _prep_resize. This change fixes the unit test to raise the error in the proper statement and validate the intended code path. Change-Id: Iadcc1944b43cc11d5e9d4c27e4949d811c2dcdfb
1 parent 9cdecc8 commit be9fe5c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

nova/tests/unit/compute/test_compute_mgr.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10527,6 +10527,7 @@ def doit(mock_pr, mock_r):
1052710527
self._mock_rt().reportclient = reportclient
1052810528
mock_pr.side_effect = test.TestingException
1052910529
mock_r.side_effect = test.TestingException
10530+
request_spec = objects.RequestSpec()
1053010531

1053110532
instance = objects.Instance(uuid=uuids.instance,
1053210533
id=1,
@@ -10539,7 +10540,7 @@ def doit(mock_pr, mock_r):
1053910540
self.compute.prep_resize,
1054010541
self.context, mock.sentinel.image,
1054110542
instance, flavor,
10542-
mock.sentinel.request_spec,
10543+
request_spec,
1054310544
{}, 'node', False,
1054410545
migration, [])
1054510546

@@ -10549,7 +10550,11 @@ def doit(mock_pr, mock_r):
1054910550
migration.save.assert_called_once_with()
1055010551
mock_r.assert_called_once_with(
1055110552
self.context, instance, mock.ANY, flavor,
10552-
mock.sentinel.request_spec, {}, [])
10553+
request_spec, {}, [])
10554+
mock_pr.assert_called_once_with(
10555+
self.context, mock.sentinel.image,
10556+
instance, flavor, {}, 'node', migration,
10557+
request_spec, False)
1055310558
mock_notify_resize.assert_has_calls([
1055410559
mock.call(self.context, instance, 'fake-mini',
1055510560
'start', flavor),

0 commit comments

Comments
 (0)