commit ee57c65fa26d0be473be9d5e55748abd6693ad0d
Author: Daniel P. Berrange <email address hidden>
Date: Tue Jul 15 17:15:18 2014 +0100
libvirt: fix recent test changes to work on libvirt < 0.9.13
The newly used 'listAllDomains' method was only introduced in
libvirt 0.9.13. Although the driver code was written to cope
with older libvirt, the test suite code itself would fail
when faced with such an old libvirt because it was trying to
mock out methods which did not exist.
The fix here recognises that since '_list_instance_domains_fast'
and '_list_instance_domains_slow' both have explicit test cases,
there is no point in mocking out the low level 'listAllDomains'
method in all the other test cases. Instead we can mock out
the much higher level '_list_instance_domains' which means we
avoid any interaction with libvirt in these test cases. The
opportunity is taken to convert the tests in question to use
'mock' instead of 'mox' since it also simplifies the code.
Finally in the test for '_list_instance_domains_fast' simply
skip the test if libvirt is too old to have the required
constants defined.
Reviewed: https:/ /review. openstack. org/107101 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=ee57c65fa26 d0be473be9d5e55 748abd6693ad0d
Committed: https:/
Submitter: Jenkins
Branch: master
commit ee57c65fa26d0be 473be9d5e55748a bd6693ad0d
Author: Daniel P. Berrange <email address hidden>
Date: Tue Jul 15 17:15:18 2014 +0100
libvirt: fix recent test changes to work on libvirt < 0.9.13
The newly used 'listAllDomains' method was only introduced in
libvirt 0.9.13. Although the driver code was written to cope
with older libvirt, the test suite code itself would fail
when faced with such an old libvirt because it was trying to
mock out methods which did not exist.
The fix here recognises that since '_list_ instance_ domains_ fast' instance_ domains_ slow' both have explicit test cases, instance_ domains' which means we
and '_list_
there is no point in mocking out the low level 'listAllDomains'
method in all the other test cases. Instead we can mock out
the much higher level '_list_
avoid any interaction with libvirt in these test cases. The
opportunity is taken to convert the tests in question to use
'mock' instead of 'mox' since it also simplifies the code.
Finally in the test for '_list_ instance_ domains_ fast' simply
skip the test if libvirt is too old to have the required
constants defined.
Closes-bug: 1341729 306176e7524502e 005cebd8c16
Change-Id: I554352ea14e6b3