From 95de4d21348ac052f8859b7b858bd9ccfa67c0db Mon Sep 17 00:00:00 2001 From: zhongjun Date: Wed, 31 Jan 2018 17:05:53 +0800 Subject: [PATCH] Fix boolean types in db migration tests In gate py27 and py35 unit tests are failing on alembic migration tests with exceptions like this [1]. Apparently sqlAlchemy 1.2.1 enforces type checks for database fields that 1.1.15 just coerced. Change strings to booleans and ints in the test code so that fields in the "fakes" match the fields in the sqlalchemy models. Co-Authored-By: Tom Barron [1] http://logs.openstack.org/68/539468/1/check/openstack-tox-py27/db4a572/job-output.txt.gz#_2018-01-31_09_26_49_316004 Change-Id: Iadffb8a06b4d948d77fc00b85118e538b0a19b24 --- .../db/migrations/alembic/migrations_data_checks.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/manila/tests/db/migrations/alembic/migrations_data_checks.py b/manila/tests/db/migrations/alembic/migrations_data_checks.py index 15108ed5c9..f72ddc8c25 100644 --- a/manila/tests/db/migrations/alembic/migrations_data_checks.py +++ b/manila/tests/db/migrations/alembic/migrations_data_checks.py @@ -130,13 +130,13 @@ def fake_share(**kwargs): 'display_description': 'my fake share', 'snapshot_id': uuidutils.generate_uuid(), 'share_proto': 'nfs', - 'is_public': '1', - 'size': '1', + 'is_public': True, + 'size': 1, 'deleted': 'False', 'share_proto': 'fake_proto', 'user_id': uuidutils.generate_uuid(), 'project_id': uuidutils.generate_uuid(), - 'snapshot_support': '1', + 'snapshot_support': True, 'task_state': None, } share.update(kwargs) @@ -375,7 +375,7 @@ class AvailabilityZoneMigrationChecks(BaseMigrationChecks): base_dict = { 'binary': 'manila-share', 'topic': 'share', - 'disabled': '0', + 'disabled': False, 'report_count': '100', } base_dict.update(options) @@ -1322,7 +1322,7 @@ class CreateFromSnapshotExtraSpecAndShareColumn(BaseMigrationChecks): 'is_public': True, }, ] - snapshot_support = ('0', '1') + snapshot_support = (False, True) dhss = ('True', 'False') for idx, share_type in enumerate(share_types): extra_specs.append({ @@ -1476,7 +1476,7 @@ class RevertToSnapshotShareColumn(BaseMigrationChecks): }, ] - snapshot_support = ('0', '1') + snapshot_support = (False, True) dhss = ('True', 'False') for idx, share_type in enumerate(share_types): extra_specs.append({