Enable local service health checks during installation
This commit is contained in:
1 parent
7e51716122
commit
52b3e84413
5 files changed
+87
-5
No files matched your search
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import stat
|
||||
import tempfile
|
||||
import unittest
|
||||
@@ -12,6 +13,7 @@ from deploy.panel_installer.config import (
|
||||
read_password,
|
||||
read_plan,
|
||||
)
|
||||
from deploy.panel_installer.engine import Installer
|
||||
from deploy.panel_installer.web import Wizard, WizardHandler, form_plan
|
||||
|
||||
PROXY = {
|
||||
@@ -24,6 +26,53 @@ ADMIN = {"username": "operator", "email": "ops@example.net"}
|
||||
|
||||
|
||||
class InstallerParametersTests(unittest.TestCase):
|
||||
def test_default_health_targets_follow_locally_installed_roles(self):
|
||||
cases = (
|
||||
({}, None, []),
|
||||
(
|
||||
{
|
||||
"dns": {"mode": "local"},
|
||||
"mail": {
|
||||
"mode": "local",
|
||||
"host": "panel.example.net",
|
||||
"tls": "acme",
|
||||
},
|
||||
},
|
||||
"8.5",
|
||||
["php-fpm", "bind9", "postfix", "dovecot", "rspamd", "redis"],
|
||||
),
|
||||
)
|
||||
for roles, php, extras in cases:
|
||||
with (
|
||||
self.subTest(roles=roles),
|
||||
patch(
|
||||
"deploy.panel_installer.engine.platform_settings",
|
||||
return_value=(php, True),
|
||||
),
|
||||
):
|
||||
plan = parse_plan({"panel": PROXY, "admin": ADMIN, **roles})
|
||||
installer = Installer(plan, "test-only", Mock())
|
||||
installer.state = dict.fromkeys(
|
||||
("secret_key", "database_password", "broker_password"),
|
||||
"test-only",
|
||||
)
|
||||
env = dict(
|
||||
line.split("=", 1)
|
||||
for line in installer.environment().splitlines()
|
||||
)
|
||||
base = [
|
||||
"panel",
|
||||
"worker",
|
||||
"scheduler",
|
||||
"apache",
|
||||
"mariadb",
|
||||
"rabbitmq",
|
||||
]
|
||||
self.assertEqual(
|
||||
json.loads(env["COULOBRE_SERVICE_HEALTH"]),
|
||||
{"panel": {"local": base + extras}},
|
||||
)
|
||||
|
||||
def test_interactive_export_reuses_the_same_plan(self):
|
||||
plan = parse_plan(
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user