|
|
@@ -5,31 +5,38 @@ import tempfile
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
+def _generate_traefik_template(output_dir: Path) -> None:
|
|
|
+ """Helper function to generate traefik template.
|
|
|
+
|
|
|
+ Args:
|
|
|
+ output_dir: Directory where template should be generated
|
|
|
+ """
|
|
|
+ subprocess.run(
|
|
|
+ [
|
|
|
+ "python3",
|
|
|
+ "-m",
|
|
|
+ "cli",
|
|
|
+ "compose",
|
|
|
+ "generate",
|
|
|
+ "traefik",
|
|
|
+ "--no-interactive",
|
|
|
+ "-o",
|
|
|
+ str(output_dir),
|
|
|
+ "--var",
|
|
|
+ "traefik_tls_acme_email=test@example.com",
|
|
|
+ ],
|
|
|
+ capture_output=True,
|
|
|
+ text=True,
|
|
|
+ check=True,
|
|
|
+ )
|
|
|
+
|
|
|
+
|
|
|
def test_traefik_no_duplicate_ping_entrypoint():
|
|
|
"""Test that the traefik template does not generate duplicate --ping.entryPoint arguments."""
|
|
|
# Generate the template
|
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
|
output_dir = Path(tmpdir)
|
|
|
-
|
|
|
- # Run the CLI to generate the traefik template
|
|
|
- subprocess.run(
|
|
|
- [
|
|
|
- "python3",
|
|
|
- "-m",
|
|
|
- "cli",
|
|
|
- "compose",
|
|
|
- "generate",
|
|
|
- "traefik",
|
|
|
- "--no-interactive",
|
|
|
- "-o",
|
|
|
- str(output_dir),
|
|
|
- "--var",
|
|
|
- "traefik_tls_acme_email=test@example.com",
|
|
|
- ],
|
|
|
- capture_output=True,
|
|
|
- text=True,
|
|
|
- check=True,
|
|
|
- )
|
|
|
+ _generate_traefik_template(output_dir)
|
|
|
|
|
|
# Read the generated compose.yaml
|
|
|
compose_file = output_dir / "compose.yaml"
|
|
|
@@ -52,26 +59,7 @@ def test_traefik_template_renders_successfully():
|
|
|
# Generate the template
|
|
|
with tempfile.TemporaryDirectory() as tmpdir:
|
|
|
output_dir = Path(tmpdir)
|
|
|
-
|
|
|
- # Run the CLI to generate the traefik template
|
|
|
- subprocess.run(
|
|
|
- [
|
|
|
- "python3",
|
|
|
- "-m",
|
|
|
- "cli",
|
|
|
- "compose",
|
|
|
- "generate",
|
|
|
- "traefik",
|
|
|
- "--no-interactive",
|
|
|
- "-o",
|
|
|
- str(output_dir),
|
|
|
- "--var",
|
|
|
- "traefik_tls_acme_email=test@example.com",
|
|
|
- ],
|
|
|
- capture_output=True,
|
|
|
- text=True,
|
|
|
- check=True,
|
|
|
- )
|
|
|
+ _generate_traefik_template(output_dir)
|
|
|
|
|
|
# Verify compose.yaml exists (main file)
|
|
|
assert (output_dir / "compose.yaml").exists(), "compose.yaml not generated"
|