mirror of
https://github.com/dartdavros/chatballs.git
synced 2026-10-05 09:14:58 +03:00
✨ feat(platform): isolate runtime surfaces
This commit is contained in:
1 parent
eac4aede40
commit
dd849fa2d4
38 files changed
+898
-456
No files matched your search
@@ -89,7 +89,7 @@ if [[ "$1" == "compose" ]]; then
|
||||
svc="${@: -1}"
|
||||
echo "{\"Service\":\"$svc\",\"Health\":\"healthy\"}"
|
||||
exit 0 ;;
|
||||
*"exec -T backend"*) exit 0 ;;
|
||||
*"exec -T backend-app"*) exit 0 ;;
|
||||
*"logs"*) exit 0 ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
@@ -144,7 +144,8 @@ def fake_env(tmp_path: Path):
|
||||
def write_env(**overrides) -> Path:
|
||||
lines = {
|
||||
"COMPOSE_PROJECT_NAME": "custocrm_test",
|
||||
"CUSTOCRM_DOMAIN": "hub.test",
|
||||
"CUSTOCRM_APP_DOMAIN": "app.test",
|
||||
"CUSTOCRM_PLATFORM_DOMAIN": "platform.test",
|
||||
"CUSTOCRM_ACME_EMAIL": "admin@test",
|
||||
"HUB_SECRET_KEY": "test-secret-not-default",
|
||||
"HUB_FIELD_ENCRYPTION_KEY": "",
|
||||
@@ -154,8 +155,10 @@ def fake_env(tmp_path: Path):
|
||||
"POSTGRES_HOST": "postgres",
|
||||
"POSTGRES_PORT": "5432",
|
||||
"REDIS_URL": "redis://redis:6379/0",
|
||||
"HUB_ALLOWED_HOSTS": "hub.test",
|
||||
"HUB_HEALTHCHECK_HOST": "hub.test",
|
||||
"CUSTOCRM_APP_ALLOWED_HOSTS": "app.test",
|
||||
"CUSTOCRM_PLATFORM_ALLOWED_HOSTS": "platform.test",
|
||||
"CUSTOCRM_APP_HEALTHCHECK_HOST": "app.test",
|
||||
"CUSTOCRM_PLATFORM_HEALTHCHECK_HOST": "platform.test",
|
||||
}
|
||||
lines.update(overrides)
|
||||
body = "".join(f"{k}={v}\n" for k, v in lines.items())
|
||||
|
||||
@@ -64,8 +64,11 @@ def test_deploy_success_orders_canonical_workflow(fake_env):
|
||||
idx_pull = _index_of(log, " pull")
|
||||
idx_infra = _index_of(log, " up -d postgres redis")
|
||||
idx_init = _index_of(log, "run --rm init")
|
||||
idx_app = _index_of(log, " up -d backend worker frontend gateway")
|
||||
idx_exec = _index_of(log, "exec -T backend")
|
||||
idx_app = _index_of(
|
||||
log,
|
||||
" up -d backend-app backend-platform backend-admin worker frontend gateway",
|
||||
)
|
||||
idx_exec = _index_of(log, "exec -T backend-app")
|
||||
|
||||
assert idx_pull < idx_infra < idx_init < idx_app < idx_exec, joined
|
||||
assert "seed_hub_initial_data" not in joined # init не запускает Edevs seed
|
||||
@@ -89,7 +92,10 @@ def test_deploy_includes_coturn_when_calls_profile_active(fake_env):
|
||||
r = _run(fake_env, "deploy", "--non-interactive")
|
||||
assert r.returncode == 0, r.stderr
|
||||
joined = "\n".join(_log_lines(fake_env))
|
||||
assert "up -d backend worker frontend gateway coturn" in joined
|
||||
assert (
|
||||
"up -d backend-app backend-platform backend-admin worker frontend gateway coturn"
|
||||
in joined
|
||||
)
|
||||
|
||||
|
||||
def test_deploy_rejects_shared_web_and_turn_ip(fake_env):
|
||||
@@ -208,6 +214,17 @@ def test_doctor_fails_when_acme_email_missing(fake_env):
|
||||
assert "CUSTOCRM_ACME_EMAIL" in result.stderr
|
||||
|
||||
|
||||
def test_doctor_fails_when_surface_domains_match(fake_env):
|
||||
fake_env.write_env(CUSTOCRM_PLATFORM_DOMAIN="app.test")
|
||||
fake_env.install_docker()
|
||||
fake_env.install_flock(held=False)
|
||||
|
||||
result = _run(fake_env, "doctor")
|
||||
|
||||
assert result.returncode == 1
|
||||
assert "must be distinct" in result.stderr
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# status
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user