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

DPE-5178 Upgrade fix for admin-address enabled charm #520

Merged
merged 1 commit into from
Sep 12, 2024
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
5 changes: 3 additions & 2 deletions lib/charms/mysql/v0/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def wait_until_mysql_connection(self) -> None:
# Increment this major API version when introducing breaking changes
LIBAPI = 0

LIBPATCH = 71
LIBPATCH = 72
Copy link
Contributor

Choose a reason for hiding this comment

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

I read 72 was planned for @shayancanonical in some of reviews...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the next one, so it depends who merges it first


UNIT_TEARDOWN_LOCKNAME = "unit-teardown"
UNIT_ADD_LOCKNAME = "unit-add"
Expand Down Expand Up @@ -2247,8 +2247,9 @@ def get_cluster_members_addresses(self) -> Optional[Iterable[str]]:

def verify_server_upgradable(self, instance: Optional[str] = None) -> None:
"""Wrapper for API check_for_server_upgrade."""
# use cluster admin user to enforce standard port usage
check_command = [
f"shell.connect('{self.instance_def(self.server_config_user, host=instance)}')",
f"shell.connect('{self.instance_def(self.cluster_admin_user, host=instance)}')",
"try:",
" util.check_for_server_upgrade(options={'outputFormat': 'JSON'})",
"except ValueError:", # ValueError is raised for same version check
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/test_mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1728,7 +1728,7 @@ def test_set_cluster_primary(self, _run_mysqlsh_script):
def test_verify_server_upgradable(self, _run_mysqlsh_script):
"""Test is_server_upgradable."""
commands = (
"shell.connect('serverconfig:serverconfigpassword@127.0.0.1:33062')",
"shell.connect('clusteradmin:clusteradminpassword@2.3.4.5:3306')",
"try:\n util.check_for_server_upgrade(options={'outputFormat': 'JSON'})",
"except ValueError:",
" if session.run_sql('select @@version').fetch_all()[0][0].split('-')[0] == shell.version.split()[1]:",
Expand All @@ -1752,7 +1752,7 @@ def test_verify_server_upgradable(self, _run_mysqlsh_script):
'"detectedProblems": [] }],'
'"manualChecks": []}'
)
self.mysql.verify_server_upgradable()
self.mysql.verify_server_upgradable("2.3.4.5")
_run_mysqlsh_script.assert_called_with("\n".join(commands))
_run_mysqlsh_script.return_value = (
'{"serverAddress": "10.1.148.145:33060",'
Expand Down
Loading