[openstack-dev] [nova] Compute test issues - nova.tests.compute.test_compute.py

Nikola Đipanov ndipanov at redhat.com
Wed Oct 31 12:56:26 UTC 2012


Hi guys,

I reported a bug yesterday I'm going to fix soon
(https://bugs.launchpad.net/nova/+bug/1073240) and the fact that it was
missed seemed to indicate that some paths in the code were never
exercised - so I started looking at the tests for compute that
exercise nova.compute.api.API mehtods (mostly
nova.tests.compute.test_compute), and I noticed 2 main issues.

1) BaseTestCase setUp or init method does not create an rpc connection
and does not register the Manager for the RPC callbacks. This means that
any call to any of the compute_api methods that in turn do an rpc call
will not do anything (to add insult to injury
openstack.common.rpc.impl_fake that is used in tests will return a nice
list with one None if there is nothing listening on the topic, and
(un)helpfully hide this issue). It's pretty easy to fix but then you
realize...

2) To test some of the functionality, test functions make calls both on
self.compute_api (an instance of nova.compute,api.API)  and the
self.compute (an instance of nova.compute.manager.ComputeManager) member
without any clear reason behind it. This is obviously wrong or at least
inconsistent with real world behaviour since one is happening inside the
nova-api service while the other inside the compute service. Some tests
are obviously wrong since once you get the manager and rpc involved - 12
of them start failing.

My thinking is that we should either have two separate test suites - one
that exercises the ComputeManager alone and the other that puts the
compute manager api functions to the test, or stick with a single
"integration-like" set of tests but *always* make calls to the API side
of things and make sure that both rpc and manager calls work as expected.

I would like to hear thoughts on this - but these tests really should be
fixed since the bug mentioned above was missed purely because rpc calls
are simply not attempted.

Cheers,

Nikola Đipanov
SSE, Red Hat




More information about the OpenStack-dev mailing list