summaryrefslogtreecommitdiff
path: root/glance/tests/functional/db/test_migrations.py
diff options
context:
space:
mode:
authorAbhishek Kekane <akekane@redhat.com>2022-10-18 12:51:41 +0000
committerAbhishek Kekane <akekane@redhat.com>2023-01-18 04:57:34 +0000
commit9786936915f7745c2b9109eb475962f41a0df67b (patch)
tree52dbcfc6a5da4fd3f66e63fb0afebc9fde9daf68 /glance/tests/functional/db/test_migrations.py
parentd07187f7107b02f42cfa335a22763cbb1c085587 (diff)
downloadglance-9786936915f7745c2b9109eb475962f41a0df67b.tar.gz
Update migration constant
Update the data migration current release to '2023_1'. Added empty migration scripts to rule out regression scenarios as well. Change-Id: Ic97825dd9c38ec1c759e5ca610a19c93fe4ca6a6
Diffstat (limited to 'glance/tests/functional/db/test_migrations.py')
-rw-r--r--glance/tests/functional/db/test_migrations.py53
1 files changed, 38 insertions, 15 deletions
diff --git a/glance/tests/functional/db/test_migrations.py b/glance/tests/functional/db/test_migrations.py
index 0f7f0b4df..150af726d 100644
--- a/glance/tests/functional/db/test_migrations.py
+++ b/glance/tests/functional/db/test_migrations.py
@@ -63,21 +63,44 @@ class TestVersions(test_utils.BaseTestCase):
for prefix in exception_releases]):
continue
- # File format should be release_phaseNN_description.py
- try:
- _rest = '' # noqa
- release, phasever, _rest = version_file.split('_', 2)
- except ValueError:
- release = phasever = ''
- phase = ''.join(x for x in phasever if x.isalpha())
- # Grab the non-numeric part of phaseNN
- if phase not in required_phases:
- # Help make sure that going forward developers stick to the
- # consistent format.
- self.fail('Migration files should be in the form of: '
- 'release_phaseNN_some_description.py '
- '(while processing %r)' % version_file)
- releases[release].add(phase)
+ # For legacy database scripts does not starts with
+ # YYYY i.e. pre Antelope
+ if not version_file.split('_', 2)[0].isnumeric():
+ # File format should be release_phaseNN_description.py
+ try:
+ _rest = '' # noqa
+ release, phasever, _rest = version_file.split('_', 2)
+ except ValueError:
+ release = phasever = ''
+ phase = ''.join(x for x in phasever if x.isalpha())
+ # Grab the non-numeric part of phaseNN
+ if phase not in required_phases:
+ # Help make sure that going forward developers stick to the
+ # consistent format.
+ self.fail('Migration files should be in the form of: '
+ 'release_phaseNN_some_description.py '
+ '(while processing %r)' % version_file)
+ releases[release].add(phase)
+ else:
+ # For new database scripts i.e. Antelope onwards
+ # File format should be
+ # releaseYear_releaseN_phaseNN_description.py
+ # For example 2023_1_expand01_empty.py
+ try:
+ _rest = '' # noqa
+ release_y, release_n, phasever, _rest = version_file.split(
+ '_', 3)
+ except ValueError:
+ release_y = phasever = ''
+ phase = ''.join(x for x in phasever if x.isalpha())
+ # Grab the non-numeric part of phaseNN
+ if phase not in required_phases:
+ # Help make sure that going forward developers stick to the
+ # consistent format.
+ self.fail('Migration files should be in the form of: '
+ 'releaseYear_releaseN_phaseNN_description.py '
+ '(while processing %r)' % version_file)
+ releases[release_y].add(phase)
for release, phases in releases.items():
missing = required_phases - phases