summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Podolyaka <rpodolyaka@mirantis.com>2013-06-25 16:54:32 +0300
committerRoman Podolyaka <rpodolyaka@mirantis.com>2013-06-25 17:12:53 +0300
commitc978691a5fcd7332a81a9f4b229c244ac0a3a6d9 (patch)
treeb9c9c5a826d1b64f9bc58e41afa4964da9b2c8b1
parent24129187ed642f99e6085f8bd44da5a9eb39034f (diff)
downloadnova-c978691a5fcd7332a81a9f4b229c244ac0a3a6d9.tar.gz
nova-c978691a5fcd7332a81a9f4b229c244ac0a3a6d9.tar.xz
nova-c978691a5fcd7332a81a9f4b229c244ac0a3a6d9.zip
Fix types in test_ec2_ids_not_found_are_printable
This test fails on PostgreSQL when trying to compare the VolumeIdMapping.id column (Integer) with a passed string value. Blueprint: db-api-tests-on-all-backends Change-Id: Ie529d25029667a5279f9c70f0f3f081b87fb6acb
-rw-r--r--nova/tests/db/test_db_api.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/nova/tests/db/test_db_api.py b/nova/tests/db/test_db_api.py
index 279481d87..d350a1684 100644
--- a/nova/tests/db/test_db_api.py
+++ b/nova/tests/db/test_db_api.py
@@ -152,18 +152,18 @@ class DbApiTestCase(DbTestCase):
self.flags(osapi_compute_unique_server_name_scope=None)
def test_ec2_ids_not_found_are_printable(self):
- def check_exc_format(method):
+ def check_exc_format(method, value):
try:
- method(self.context, 'fake')
+ method(self.context, value)
except exception.NotFound as exc:
- self.assertTrue('fake' in unicode(exc))
-
- check_exc_format(db.get_ec2_volume_id_by_uuid)
- check_exc_format(db.get_volume_uuid_by_ec2_id)
- check_exc_format(db.get_ec2_snapshot_id_by_uuid)
- check_exc_format(db.get_snapshot_uuid_by_ec2_id)
- check_exc_format(db.get_ec2_instance_id_by_uuid)
- check_exc_format(db.get_instance_uuid_by_ec2_id)
+ self.assertTrue(unicode(value) in unicode(exc))
+
+ check_exc_format(db.get_ec2_volume_id_by_uuid, 'fake')
+ check_exc_format(db.get_volume_uuid_by_ec2_id, 123456)
+ check_exc_format(db.get_ec2_snapshot_id_by_uuid, 'fake')
+ check_exc_format(db.get_snapshot_uuid_by_ec2_id, 123456)
+ check_exc_format(db.get_ec2_instance_id_by_uuid, 'fake')
+ check_exc_format(db.get_instance_uuid_by_ec2_id, 123456)
def test_instance_get_all_with_meta(self):
inst = self.create_instance_with_args()