Enhance EvacuateHostTestCase test cases
Currently even if the EvacuateHostTestCase test cases pass, there are some error log in the logs, it may lead to confusion when debug the problem, and more important, it will fail if the 'node' variable is used in the compute layer code since the 'node' is None and the cases will fail. Use stub by purpose because don't want to change current test structure. 2014-12-18 18:20:23,694 ERROR [nova.compute.manager] Failed to get compute_info for fake-mini Traceback (most recent call last): File "/home/jichen/git/nova/nova/compute/manager.py", line 2797, in rebuild_instance compute_node = self._get_compute_info(context, self.host) File "/home/jichen/git/nova/nova/compute/manager.py", line 4859, in _get_compute_info service = objects.Service.get_by_compute_host(context, host) File "/home/jichen/git/nova/nova/objects/base.py", line 156, in wrapper result = fn(cls, context, *args, **kwargs) File "/home/jichen/git/nova/nova/objects/service.py", line 111, in get_by_compute_host db_service = db.service_get_by_compute_host(context, host) File "/home/jichen/git/nova/nova/db/api.py", line 131, in service_get_by_compute_host use_slave=use_slave) File "/home/jichen/git/nova/nova/db/sqlalchemy/api.py", line 127, in wrapper return f(*args, **kwargs) File "/home/jichen/git/nova/nova/db/sqlalchemy/api.py", line 431, in service_get_by_compute_host raise exception.ComputeHostNotFound(host=host) ComputeHostNotFound: Compute host fake-mini could not be found. Change-Id: I5541fc27afc23346ddcd685667737548b2a813c7 Partial-Bug: #1289064
This commit is contained in:
parent
018efbf9a4
commit
737fb8e7a7
|
@ -10986,6 +10986,13 @@ class EvacuateHostTestCase(BaseTestCase):
|
|||
self.inst.task_state = task_states.REBUILDING
|
||||
self.inst.save()
|
||||
|
||||
def fake_get_compute_info(context, host):
|
||||
cn = objects.ComputeNode(hypervisor_hostname=self.rt.nodename)
|
||||
return cn
|
||||
|
||||
self.stubs.Set(self.compute, '_get_compute_info',
|
||||
fake_get_compute_info)
|
||||
|
||||
def tearDown(self):
|
||||
db.instance_destroy(self.context, self.inst.uuid)
|
||||
super(EvacuateHostTestCase, self).tearDown()
|
||||
|
|
Loading…
Reference in New Issue