Package standalone app and automate MySQL setup

This commit is contained in:
王鹏
2026-10-09 08:22:29 +08:00
parent d1695eba74
commit 0e7f52e26a
8 changed files with 67 additions and 9 deletions

View File

@@ -11,6 +11,12 @@ from deploy_tool.scanner import ProjectComponent, ScanResult
class DeployerTests(unittest.TestCase):
def test_frozen_app_reuses_executable_for_service_console(self):
with patch.object(deployer_module.sys, "frozen", True, create=True):
launcher = deployer_module._service_console_launcher()
self.assertEqual(launcher, [deployer_module.sys.executable, "--service-console"])
def test_extracts_backend_port_from_java_system_property(self):
extract_port = getattr(deployer_module, "_extract_server_port", lambda command: None)

View File

@@ -78,12 +78,34 @@ class InstallerTests(unittest.TestCase):
def test_builds_jdk_winget_install_command(self):
command = build_install_command("JDK", version="8")
self.assertEqual(command, ["winget", "install", "-e", "--id", "EclipseAdoptium.Temurin.8.JDK"])
self.assertEqual(
command,
[
"winget",
"install",
"--exact",
"--id",
"EclipseAdoptium.Temurin.8.JDK",
"--accept-source-agreements",
"--accept-package-agreements",
"--disable-interactivity",
],
)
def test_builds_node_winget_install_command(self):
command = build_install_command("Node.js")
self.assertEqual(command, ["winget", "install", "-e", "--id", "OpenJS.NodeJS.LTS"])
self.assertEqual(command[0:5], ["winget", "install", "--exact", "--id", "OpenJS.NodeJS.LTS"])
self.assertIn("--accept-package-agreements", command)
self.assertIn("--disable-interactivity", command)
def test_builds_unattended_mysql_winget_install_command(self):
command = build_install_command("MySQL")
self.assertEqual(command[0:5], ["winget", "install", "--exact", "--id", "Oracle.MySQL"])
self.assertIn("--accept-source-agreements", command)
self.assertIn("--accept-package-agreements", command)
self.assertIn("--disable-interactivity", command)
def test_maven_is_not_offered_as_an_invalid_winget_package(self):
with self.assertRaises(ValueError):