This bug refers to the unit testing infrastructure used before the Grizzly
refactory.
It doesn't apply to the current codebase.
** Changed in: nova
Status: Confirmed => Invalid
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Compute (nova).
https://bugs.launchpad.net/bugs/1053540
Title:
Hyper-V test_live_migration_with_target_failure unit test is broken
Status in OpenStack Compute (Nova):
Invalid
Bug description:
I've been going through the unit tests and auditing uses of 'except
Exception' to see if they are buggy since they are often too liberal
with the exceptions they catch and hide real bugs.
The test_live_migration_with_target_failure unit test is obfuscating
either a real bug or a testing bug.
Removing the try/except block ends up with this confusing set of
exceptions:
======================================================================
ERROR: test_live_migration_with_target_failure
(nova.tests.test_hypervapi.HyperVAPITestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/johannes/openstack/nova/trunk/nova/tests/test_hypervapi.py",
line 299, in test_live_migration_with_target_failure
self._live_migration(dest_server)
File "/home/johannes/openstack/nova/trunk/nova/tests/test_hypervapi.py",
line 321, in _live_migration
dest_server, fake_post_method, fake_recover_method)
File "/home/johannes/openstack/nova/trunk/nova/virt/hyperv/driver.py", line
166, in live_migration
post_method, recover_method, block_migration)
File
"/home/johannes/openstack/nova/trunk/nova/virt/hyperv/livemigrationops.py",
line 131, in live_migration
recover_method(context, instance_ref, dest, block_migration)
File "/usr/lib/python2.6/contextlib.py", line 23, in __exit__
self.gen.next()
File
"/home/johannes/openstack/nova/trunk/nova/virt/hyperv/livemigrationops.py",
line 97, in live_migration
moniker='//' + dest + '/root/virtualization/v2')
File "/home/johannes/openstack/nova/trunk/nova/tests/hyperv/mockproxy.py",
line 88, in newfunc
return self._get_next_ret_value(name, params)
File "/home/johannes/openstack/nova/trunk/nova/tests/hyperv/mockproxy.py",
line 72, in _get_next_ret_value
return self._values[name][params][c]
KeyError: '\'(\\\'(\\\\\\\'()\\\\\\\', "{\\\\\\\'moniker\\\\\\\':
\\\\\\\'//nonexistingserver/root/virtualization/v2\\\\\\\'}")\\\',
\\\'{}\\\')\'\n-------------------- >> begin captured logging <<
--------------------\nnova.virt.hyperv.vmops: INFO: Created disk for
openstack_unit_test_vm_f2e6c57f-64d1-4a6c-823f-276a8bdcc16d\nnova.virt.hyperv.vmops:
INFO: Created nic for
openstack_unit_test_vm_f2e6c57f-64d1-4a6c-823f-276a8bdcc16d
\nnova.virt.hyperv.vmops: INFO: Successfully changed vm state of
openstack_unit_test_vm_f2e6c57f-64d1-4a6c-823f-276a8bdcc16d to
Enabled\nnova.virt.hyperv.vmops: INFO: Started VM
openstack_unit_test_vm_f2e6c57f-64d1-4a6c-823f-276a8bdcc16d
\n--------------------- >> end captured logging << ---------------------'
======================================================================
ERROR: test_live_migration_with_target_failure
(nova.tests.test_hypervapi.HyperVAPITestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/johannes/openstack/nova/trunk/nova/tests/test_hypervapi.py",
line 139, in tearDown
self._hypervutils.remove_vm(self._instance_data["name"])
File
"/home/johannes/openstack/nova/trunk/nova/tests/hyperv/hypervutils.py", line
176, in remove_vm
self._remove_vm(vm_name, self._conn, self._conn_cimv2)
File
"/home/johannes/openstack/nova/trunk/nova/tests/hyperv/hypervutils.py", line
179, in _remove_vm
vm = self._get_vm(vm_name, conn)
File
"/home/johannes/openstack/nova/trunk/nova/tests/hyperv/hypervutils.py", line
96, in _get_vm
return vml[0]
File "/home/johannes/openstack/nova/trunk/nova/tests/hyperv/mockproxy.py",
line 103, in __getitem__
return self._get_next_ret_value('__getitem__', str(key))
File "/home/johannes/openstack/nova/trunk/nova/tests/hyperv/mockproxy.py",
line 72, in _get_next_ret_value
return self._values[name][params][c]
KeyError: "'__getitem__'\n-------------------- >> begin captured logging <<
--------------------\nnova.virt.hyperv.vmops: INFO: Created disk for
openstack_unit_test_vm_f2e6c57f-64d1-4a6c-823f-276a8bdcc16d\nnova.virt.hyperv.vmops:
INFO: Created nic for
openstack_unit_test_vm_f2e6c57f-64d1-4a6c-823f-276a8bdcc16d
\nnova.virt.hyperv.vmops: INFO: Successfully changed vm state of
openstack_unit_test_vm_f2e6c57f-64d1-4a6c-823f-276a8bdcc16d to
Enabled\nnova.virt.hyperv.vmops: INFO: Started VM
openstack_unit_test_vm_f2e6c57f-64d1-4a6c-823f-276a8bdcc16d
\n--------------------- >> end captured logging << ---------------------"
The 'except Exception' was catching the KeyError exception and treating it as
a success, which is not the intended result. From the comments in the test, it
appears that a pythoncom.com_error exception is raised, but it cannot be caught
with assertRaises()? I don't know what that exception is (it's not referenced
in any other code) and not sure why it can't be used with assertRaises().
I spent some time trying to fix this test, but got mired in too much
weird code to make much headway.
To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1053540/+subscriptions
--
Mailing list: https://launchpad.net/~yahoo-eng-team
Post to : [email protected]
Unsubscribe : https://launchpad.net/~yahoo-eng-team
More help : https://help.launchpad.net/ListHelp