diff options
| author | Chris Behrens <cbehrens@codestud.com> | 2013-01-08 21:46:01 +0000 |
|---|---|---|
| committer | Chris Behrens <cbehrens@codestud.com> | 2013-01-08 21:46:01 +0000 |
| commit | 14fcded53ded17a1c10325453c2e04458955301f (patch) | |
| tree | c7778ee5180f5f76421f38c26372b18fce6ceaba /nova | |
| parent | 61e9e0112bf2fd09892a5e1974d4f454ea2a4469 (diff) | |
| download | nova-14fcded53ded17a1c10325453c2e04458955301f.tar.gz nova-14fcded53ded17a1c10325453c2e04458955301f.tar.xz nova-14fcded53ded17a1c10325453c2e04458955301f.zip | |
Clarify the DBApi object in cells fakes
Adds a docstring and makes instance_get_by_uuid() raise by default.
It's only used as a stubbing point, but returning 'None' is not really
valid and having it raise might save someone some confusion in the
future.
Change-Id: Ie3fa333288f9c0263ead69c2d307101b8583dea7
Diffstat (limited to 'nova')
| -rw-r--r-- | nova/tests/cells/fakes.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/nova/tests/cells/fakes.py b/nova/tests/cells/fakes.py index e1f3b6e70..e996cbe13 100644 --- a/nova/tests/cells/fakes.py +++ b/nova/tests/cells/fakes.py @@ -22,6 +22,7 @@ from nova.cells import messaging from nova.cells import state as cells_state import nova.db from nova.db import base +from nova import exception from nova.openstack.common import cfg CONF = cfg.CONF @@ -43,6 +44,10 @@ CELL_NAME_TO_STUB_INFO = {} class FakeDBApi(object): + """Cells uses a different DB in each cell. This means in order to + stub out things differently per cell, I need to create a fake DBApi + object that is instantiated by each fake cell. + """ def __init__(self, cell_db_entries): self.cell_db_entries = cell_db_entries @@ -58,8 +63,8 @@ class FakeDBApi(object): def instance_get_all_by_filters(self, ctxt, *args, **kwargs): return [] - def instance_get_by_uuid(self, ctxt, *args, **kwargs): - return None + def instance_get_by_uuid(self, ctxt, instance_uuid): + raise exception.InstanceNotFound(instance_id=instance_uuid) class FakeCellsDriver(driver.BaseCellsDriver): |
