Skip to content

Commit 1b4d923

Browse files
authored
use cluster admin user when checking upgradability, use default port (#520)
1 parent f4c8d83 commit 1b4d923

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/charms/mysql/v0/mysql.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def wait_until_mysql_connection(self) -> None:
134134
# Increment this major API version when introducing breaking changes
135135
LIBAPI = 0
136136

137-
LIBPATCH = 71
137+
LIBPATCH = 72
138138

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

22482248
def verify_server_upgradable(self, instance: Optional[str] = None) -> None:
22492249
"""Wrapper for API check_for_server_upgrade."""
2250+
# use cluster admin user to enforce standard port usage
22502251
check_command = [
2251-
f"shell.connect('{self.instance_def(self.server_config_user, host=instance)}')",
2252+
f"shell.connect('{self.instance_def(self.cluster_admin_user, host=instance)}')",
22522253
"try:",
22532254
" util.check_for_server_upgrade(options={'outputFormat': 'JSON'})",
22542255
"except ValueError:", # ValueError is raised for same version check

tests/unit/test_mysql.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ def test_set_cluster_primary(self, _run_mysqlsh_script):
17281728
def test_verify_server_upgradable(self, _run_mysqlsh_script):
17291729
"""Test is_server_upgradable."""
17301730
commands = (
1731-
"shell.connect('serverconfig:[email protected]:33062')",
1731+
"shell.connect('clusteradmin:[email protected]:3306')",
17321732
"try:\n util.check_for_server_upgrade(options={'outputFormat': 'JSON'})",
17331733
"except ValueError:",
17341734
" if session.run_sql('select @@version').fetch_all()[0][0].split('-')[0] == shell.version.split()[1]:",
@@ -1752,7 +1752,7 @@ def test_verify_server_upgradable(self, _run_mysqlsh_script):
17521752
'"detectedProblems": [] }],'
17531753
'"manualChecks": []}'
17541754
)
1755-
self.mysql.verify_server_upgradable()
1755+
self.mysql.verify_server_upgradable("2.3.4.5")
17561756
_run_mysqlsh_script.assert_called_with("\n".join(commands))
17571757
_run_mysqlsh_script.return_value = (
17581758
'{"serverAddress": "10.1.148.145:33060",'

0 commit comments

Comments
 (0)