调整lsfx-mock默认数据库配置并更新NAS部署环境

This commit is contained in:
wkc
2026-03-31 23:03:14 +08:00
parent 2fdf5f1546
commit 8798aa9230
11 changed files with 213 additions and 5 deletions

View File

@@ -43,3 +43,10 @@ def test_sh_dry_run_accepts_override_arguments():
assert "Port: 2222" in result.stdout
assert "Username: deploy-user" in result.stdout
assert "RemoteRoot: /volume2/custom/app" in result.stdout
def test_sh_script_should_render_nas_env_into_stage_package():
script_text = SCRIPT_PATH.read_text(encoding="utf-8")
assert 'render_nas_env.py' in script_text
assert '"${STAGE_ROOT}/.env"' in script_text

View File

@@ -0,0 +1,37 @@
from pathlib import Path
import subprocess
import tempfile
REPO_ROOT = Path(__file__).resolve().parents[2]
SCRIPT_PATH = REPO_ROOT / "deploy" / "render_nas_env.py"
ENV_TEMPLATE = REPO_ROOT / ".env.example"
def test_render_nas_env_should_generate_lsfx_mock_db_override_file():
with tempfile.TemporaryDirectory() as tmp_dir:
output_path = Path(tmp_dir) / ".env"
result = subprocess.run(
[
"python3",
str(SCRIPT_PATH),
"--template",
str(ENV_TEMPLATE),
"--output",
str(output_path),
],
cwd=REPO_ROOT,
capture_output=True,
text=True,
)
assert result.returncode == 0
assert output_path.exists()
env_text = output_path.read_text(encoding="utf-8")
assert "CCDI_DB_HOST=192.168.0.111" in env_text
assert "CCDI_DB_PORT=40628" in env_text
assert "CCDI_DB_NAME=ccdi" in env_text