diff options
| author | Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com> | 2013-02-20 16:00:36 -0500 |
|---|---|---|
| committer | Mauro S. M. Rodrigues <maurosr@linux.vnet.ibm.com> | 2013-02-26 11:22:03 -0500 |
| commit | e2eeb1d56cf8b85380f026d618c716a2fe2c7071 (patch) | |
| tree | 9a39ea2816776c17a1731ef12144d6c2861a4b00 /nova/tests | |
| parent | 7170eb3966d4a38878e46353414579804fa987e9 (diff) | |
Revert IP Address column length to 39
In change I35d4565389d03fce86103289cf6447f824efeba0 we changed the cidr/ip
address column size to 43 to be able to support ipv6 cidr values, although ips
doesn't need that much space so we're reverting it to keep it consistent.
Change-Id: Icd2d727fd0733ee0db23c1fa431df4b982cae7b4
Diffstat (limited to 'nova/tests')
| -rw-r--r-- | nova/tests/test_migrations.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/nova/tests/test_migrations.py b/nova/tests/test_migrations.py index ef25ca726..d0e8e5035 100644 --- a/nova/tests/test_migrations.py +++ b/nova/tests/test_migrations.py @@ -47,6 +47,8 @@ import datetime import netaddr import os import sqlalchemy +from sqlalchemy.dialects import postgresql +from sqlalchemy.dialects import sqlite import sqlalchemy.exc import urlparse import uuid @@ -902,6 +904,55 @@ class TestNovaMigrations(BaseMigrationTestCase, CommonTestsMixIn): fetchall() self.assertEqual(len(rows), 1) + def _pre_upgrade_159(self, engine): + data = { + 'provider_fw_rules': + [ + {'protocol': 'tcp', 'from_port': 1234, + 'to_port': 1234, 'cidr': "127.0.0.1/30"}, + {'protocol': 'tcp', 'from_port': 1234, + 'to_port': 1234, 'cidr': "128.128.128.128/16"}, + {'protocol': 'tcp', 'from_port': 1234, + 'to_port': 1234, 'cidr': "128.128.128.128/32"}, + {'protocol': 'tcp', 'from_port': 1234, + 'to_port': 1234, 'cidr': "2001:db8::1:2/48"}, + {'protocol': 'tcp', 'from_port': 1234, + 'to_port': 1234, 'cidr': "::1/64"}, + {'protocol': 'tcp', 'from_port': 1234, 'to_port': 1234, + 'cidr': "0000:0000:0000:2013:0000:6535:abcd:ef11/64"}, + {'protocol': 'tcp', 'from_port': 1234, 'to_port': 1234, + 'cidr': "0000:1020:0000:2013:0000:6535:abcd:ef11/128"}, + ], + 'console_pools': + [ + {'address': '10.10.10.10'}, + {'address': '128.100.100.100'}, + {'address': '2002:2002:2002:2002:2002:2002:2002:2002'}, + {'address': '::1'}, + {'address': '0000:0000:0000:2013:0000:6535:abcd:ef11'} + ] + } + return data + + # migration 159 - revert ip column size + def _check_159(self, engine, data): + dialect = engine.url.get_dialect() + # NOTE(maurosr): check if column length is 39 again (it currently makes + # sense only for mysql) + if dialect not in [postgresql.dialect, sqlite.dialect]: + console_pools = get_table(engine, 'console_pools') + self.assertEqual(console_pools.columns['address'].type.length, 39) + # recheck the 149 data + self._check_149(engine, data) + + def _post_downgrade_159(self, engine): + dialect = engine.url.get_dialect() + # NOTE(maurosr): check if column length is 43 again (it currently makes + # sense only for mysql) + if dialect not in [postgresql.dialect, sqlite.dialect]: + console_pools = get_table(engine, 'console_pools') + self.assertEqual(console_pools.columns['address'].type.length, 43) + class TestBaremetalMigrations(BaseMigrationTestCase, CommonTestsMixIn): """Test sqlalchemy-migrate migrations.""" |
