调整lsfx-mock默认数据库配置并更新NAS部署环境
This commit is contained in:
@@ -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
|
||||
|
||||
37
tests/deploy/test_render_nas_env.py
Normal file
37
tests/deploy/test_render_nas_env.py
Normal 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
|
||||
|
||||
Reference in New Issue
Block a user