[Openstack] mocking database and stubs

Pitucha, Stanislaw Izaak stanislaw.pitucha at hp.com
Thu Sep 15 16:24:02 UTC 2011


Hi all,
I've got some questions about testing the bits affecting the database. Currently some places use mox, some use db_fake / stubs - this unfortunately fails when I try to add another test:

In VlanManager.setup_compute_network(), there's a call to db.network_get_by_instance. I needed to test some part of it that required specific mocking, so I followed what happens in other places of that file - changed db to self.db and used mox.

This however made the xenapi tests fail because they rely on db_fake in test_spawn_vlanmanager (it also calls setup_compute_network()).

So the way I see it now - my options are:
- rewrite xenapi tests to use mox (lots of work, really don't want to go there)
- mix mox and db_fake in a single test in test_compute (ugly / don't want to figure out the dependencies there in the future)
...
are there any other solution?

Is there any blessed way to do this in the future? Is it better to keep to db_fake or mox?

Regards,
Stanisław Pitucha
Cloud Services 
Hewlett Packard


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 6216 bytes
Desc: not available
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20110915/da8bef90/attachment.bin>


More information about the Openstack mailing list