Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[db_migrator] Set correct CURRENT_VERSION, extend UT #2895

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/db_migrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, namespace, socket=None):
none-zero values.
build: sequentially increase within a minor version domain.
"""
self.CURRENT_VERSION = 'version_4_0_2'
self.CURRENT_VERSION = 'version_4_0_3'

self.TABLE_NAME = 'VERSIONS'
self.TABLE_KEY = 'DATABASE'
Expand Down
3 changes: 2 additions & 1 deletion tests/db_migrator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -674,4 +674,5 @@ def test_fast_reboot_upgrade_to_4_0_3(self):
dbmgtr = db_migrator.DBMigrator(None)
dbmgtr.migrate()
expected_db = self.mock_dedicated_config_db(db_after_migrate)
assert not self.check_config_db(dbmgtr.configDB, expected_db.cfgdb)
assert not self.check_config_db(dbmgtr.configDB, expected_db.cfgdb)
assert dbmgtr.CURRENT_VERSION == expected_db.cfgdb.get_entry('VERSIONS', 'DATABASE')['VERSION']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a dedicated test just for checking this assertion.

My goal is to use UT to always catch the issue that this PR is addressing -- missing update to CURRENT_VERSION

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how to achieve that, because not every UT mocks the config_db with a VERSIONS key

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. May be we should always verify this assertion in the new UTs that we add. Specifically, in the changes where new version is introduced.

We can have that conversation later, let's take this bug fix for now.