From c978691a5fcd7332a81a9f4b229c244ac0a3a6d9 Mon Sep 17 00:00:00 2001 From: Roman Podolyaka Date: Tue, 25 Jun 2013 16:54:32 +0300 Subject: 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 --- nova/tests/db/test_db_api.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'nova/tests') 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() -- cgit