Add Docker test deployment on Gitea Actions
Docker test deployment / test-build-deploy (push) Successful in 4m5s
Docker test deployment / test-build-deploy (push) Successful in 4m5s
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user