diff options
author | Kurt Taylor <krtaylor@us.ibm.com> | 2013-02-08 16:12:13 -0500 |
---|---|---|
committer | Kurt Taylor <krtaylor@us.ibm.com> | 2013-02-18 08:51:19 -0500 |
commit | 8890f40e1bf0c5642bb7d59fba62bc12a530d084 (patch) | |
tree | cf1f090563c12156dd9a108fd43f7d2d951666ec | |
parent | fbe79705eb6625e5cf5653eb342c5998f88fee5a (diff) | |
download | nova-8890f40e1bf0c5642bb7d59fba62bc12a530d084.tar.gz nova-8890f40e1bf0c5642bb7d59fba62bc12a530d084.tar.xz nova-8890f40e1bf0c5642bb7d59fba62bc12a530d084.zip |
Add and check data functions for test_migrations 141
Before the 141 migration test is run, _prerun_141 populates the migrations
table with a generated uuid. The _check_141 function checks that
the uuid migrated properly down to 36 char.
Partially implements: blueprint migration-testing-with-data
Change-Id: I43b47f69a94720bf9487eb30576035493700ddca
-rw-r--r-- | nova/tests/test_migrations.py | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nova/tests/test_migrations.py b/nova/tests/test_migrations.py index e71b97513..6960d0174 100644 --- a/nova/tests/test_migrations.py +++ b/nova/tests/test_migrations.py @@ -47,6 +47,7 @@ import datetime import os import sqlalchemy import urlparse +import uuid from migrate.versioning import repository @@ -440,6 +441,24 @@ class TestMigrations(BaseMigrationTestCase): self.assertEqual(data[0]['mac'], bw['mac']) + # migration 141, update migrations instance uuid + def _prerun_141(self, engine): + data = { + 'instance_uuid': str(uuid.uuid4()) + } + migrations = get_table(engine, 'migrations') + engine.execute(migrations.insert(), data) + result = migrations.insert().values(data).execute() + data['id'] = result.inserted_primary_key[0] + return data + + def _check_141(self, engine, data): + migrations = get_table(engine, 'migrations') + row = migrations.select( + migrations.c.id == data['id']).execute().first() + # Check that change to String(36) went alright + self.assertEqual(data['instance_uuid'], row['instance_uuid']) + # migration 146, availability zone transition def _prerun_146(self, engine): data = { |