Add vm.launch testcase
This was a leftover from another patchset. Adding a test for the vm.launch method. Change-Id: I19ab411f852a18c68f61688c43e8e6579b385748
This commit is contained in:
parent
eb2bc80389
commit
324bf8f3b3
|
@ -161,3 +161,20 @@ class VmHBATestCase(TestCase):
|
|||
@mock.patch.object(vm.LOG, 'debug')
|
||||
def test_attach_hba(self, mock_debug):
|
||||
self.inst.attach_hbas(self.conf)
|
||||
|
||||
|
||||
class InstancePartitionLifecycleTestCase(TestCase):
|
||||
|
||||
@mock.patch.object(vm.PartitionInstance, "_loop_status_update")
|
||||
def test_launch(self, mock_loop_stat_upd):
|
||||
mock_part = mock.Mock()
|
||||
mock_inst = mock.Mock()
|
||||
with mock.patch.object(vm.PartitionInstance, "get_partition",
|
||||
return_value=mock_part):
|
||||
part_inst = vm.PartitionInstance(mock_inst, None, None)
|
||||
part_inst._boot_os_specific_parameters = "foo"
|
||||
part_inst.launch()
|
||||
self.assertEqual("building", mock_inst.vm_state)
|
||||
self.assertEqual("spawning", mock_inst.task_state)
|
||||
mock_inst.save.assert_called_once()
|
||||
mock_part.start.assert_called_once_with(True)
|
||||
|
|
Loading…
Reference in New Issue