Files
adcloud-server/tests/test_docker_deploy.py
T
codex-bot 789ab64013
Docker test deployment / test-build-deploy (push) Successful in 4m5s
Add Docker test deployment on Gitea Actions
2026-09-16 01:27:57 +08:00

33 lines
967 B
Python

import os
import subprocess
from pathlib import Path
SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "deploy_docker.sh"
def test_invalid_public_port_is_rejected_before_contacting_docker():
result = subprocess.run(
["bash", str(SCRIPT)],
env={**os.environ, "DEPLOY_IMAGE": "test-image", "DEPLOY_PORT": "0"},
capture_output=True,
text=True,
check=False,
)
assert result.returncode == 2
assert "Invalid deployment port" in result.stdout
def test_invalid_container_name_and_bind_ip_cannot_be_used():
for configuration in (
{"DEPLOY_NAME": "other;service"},
{"DEPLOY_BIND_IP": "example.invalid"},
):
result = subprocess.run(
["bash", str(SCRIPT)],
env={**os.environ, "DEPLOY_IMAGE": "test-image", **configuration},
capture_output=True,
text=True,
check=False,
)
assert result.returncode == 2