← Back to team overview

openstack team mailing list archive

mocking database and stubs

 

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


Attachment: smime.p7s
Description: S/MIME cryptographic signature


Follow ups