Skip to content
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 machines/src/mysql_vm_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ def initialise_mysqld(self) -> None:

try:
self.reset_data_dir()
subprocess.run(bootstrap_command) # noqa: S603
subprocess.run(bootstrap_command, check=True) # noqa: S603
except subprocess.CalledProcessError:
logger.exception("Failed to initialise MySQL data directory")
raise MySQLInitialiseMySQLDError from None
Expand Down
15 changes: 9 additions & 6 deletions machines/tests/unit/test_mysqlsh_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,12 +481,15 @@ def test_initialise_mysqld(self, _subprocess_run, _reset_data_dir):
self.mysql.initialise_mysqld()

_reset_data_dir.assert_called_once()
_subprocess_run.assert_called_once_with([
"/usr/bin/sudo",
"/snap/bin/charmed-mysql.mysqld-initialize",
"--datadir",
"/var/snap/charmed-mysql/common/var/lib/mysql",
])
_subprocess_run.assert_called_once_with(
[
"/usr/bin/sudo",
"/snap/bin/charmed-mysql.mysqld-initialize",
"--datadir",
"/var/snap/charmed-mysql/common/var/lib/mysql",
],
check=True,
)

@patch("mysql_vm_helpers.MySQL.reset_data_dir")
@patch("subprocess.run")
Expand Down
Loading