新增NAS部署脚本并补齐Mock数据库环境变量
This commit is contained in:
45
tests/deploy/test_deploy_to_nas.py
Normal file
45
tests/deploy/test_deploy_to_nas.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from pathlib import Path
|
||||
import subprocess
|
||||
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
SCRIPT_PATH = REPO_ROOT / "deploy" / "deploy-to-nas.sh"
|
||||
|
||||
|
||||
def test_sh_dry_run_uses_default_nas_target():
|
||||
result = subprocess.run(
|
||||
["bash", str(SCRIPT_PATH), "--dry-run"],
|
||||
cwd=REPO_ROOT,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
|
||||
assert result.returncode == 0
|
||||
assert "Host: 116.62.17.81" in result.stdout
|
||||
assert "Port: 9444" in result.stdout
|
||||
assert "Username: wkc" in result.stdout
|
||||
assert "RemoteRoot: /volume1/webapp/ccdi" in result.stdout
|
||||
|
||||
|
||||
def test_sh_dry_run_accepts_override_arguments():
|
||||
result = subprocess.run(
|
||||
[
|
||||
"bash",
|
||||
str(SCRIPT_PATH),
|
||||
"10.0.0.8",
|
||||
"2222",
|
||||
"deploy-user",
|
||||
"secret",
|
||||
"/volume2/custom/app",
|
||||
"--dry-run",
|
||||
],
|
||||
cwd=REPO_ROOT,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
)
|
||||
|
||||
assert result.returncode == 0
|
||||
assert "Host: 10.0.0.8" in result.stdout
|
||||
assert "Port: 2222" in result.stdout
|
||||
assert "Username: deploy-user" in result.stdout
|
||||
assert "RemoteRoot: /volume2/custom/app" in result.stdout
|
||||
15
tests/deploy/test_lsfx_mock_deploy_config.py
Normal file
15
tests/deploy/test_lsfx_mock_deploy_config.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
REPO_ROOT = Path(__file__).resolve().parents[2]
|
||||
DOCKER_COMPOSE = REPO_ROOT / "docker-compose.yml"
|
||||
|
||||
|
||||
def test_lsfx_mock_service_receives_ccdi_db_defaults():
|
||||
compose_text = DOCKER_COMPOSE.read_text(encoding="utf-8")
|
||||
|
||||
assert 'CCDI_DB_HOST: ${CCDI_DB_HOST:-192.168.0.111}' in compose_text
|
||||
assert 'CCDI_DB_PORT: ${CCDI_DB_PORT:-40627}' in compose_text
|
||||
assert 'CCDI_DB_NAME: ${CCDI_DB_NAME:-ccdi}' in compose_text
|
||||
assert 'CCDI_DB_USERNAME: ${CCDI_DB_USERNAME:-root}' in compose_text
|
||||
assert 'CCDI_DB_PASSWORD: ${CCDI_DB_PASSWORD:-Kfcx@1234}' in compose_text
|
||||
Reference in New Issue
Block a user