Capture privileged MySQL service diagnostics
This commit is contained in:
@@ -22,9 +22,11 @@ from deploy_tool.installer import (
|
||||
NODE_DIST_BASE,
|
||||
build_mysql_installer_command,
|
||||
build_mysql_server_install_command,
|
||||
build_mysql_service_start_command,
|
||||
configure_mysql_weak_password_policy,
|
||||
default_mysql_install_log_path,
|
||||
default_mysql_server_install_log_path,
|
||||
default_mysql_service_log_path,
|
||||
ensure_mysql_service_running,
|
||||
find_mysql_error_log,
|
||||
mysql_service_failure_detail,
|
||||
@@ -459,6 +461,24 @@ class InstallerTests(unittest.TestCase):
|
||||
self.assertEqual(commands, [["sc.exe", "start", "MySQL80"]])
|
||||
self.assertTrue(any("已启动" in message for message in messages))
|
||||
|
||||
def test_builds_privileged_mysql_service_start_diagnostic(self):
|
||||
command = build_mysql_service_start_command()
|
||||
|
||||
self.assertEqual(command[0], "powershell.exe")
|
||||
script = command[-1]
|
||||
self.assertIn("Start-Service -Name $name", script)
|
||||
self.assertIn("Get-CimInstance Win32_Service", script)
|
||||
self.assertIn("my.ini", script)
|
||||
self.assertIn("*.err", script)
|
||||
self.assertIn("Get-Content", script)
|
||||
|
||||
with patch.dict("os.environ", {"LOCALAPPDATA": r"C:\Users\tester\AppData\Local"}):
|
||||
log_path = default_mysql_service_log_path()
|
||||
self.assertEqual(
|
||||
log_path,
|
||||
Path(r"C:\Users\tester\AppData\Local") / "AutoDeploy" / "logs" / "mysql-service-start.log",
|
||||
)
|
||||
|
||||
def test_reports_mysql_error_log_when_service_stops_after_start(self):
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
program_data = Path(tmp)
|
||||
|
||||
Reference in New Issue
Block a user