Add Docker test deployment on Gitea Actions
Docker test deployment / test-build-deploy (push) Successful in 4m5s

This commit is contained in:
2026-09-16 01:27:57 +08:00
parent 0fc6c68a99
commit 789ab64013
10 changed files with 613 additions and 0 deletions
+32
View File
@@ -0,0 +1,32 @@
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