diff --git a/tests/custom-html/functional/test_content_roundtrip.py b/tests/custom-html/functional/test_content_roundtrip.py
index 2e08963..cbbb9e3 100644
--- a/tests/custom-html/functional/test_content_roundtrip.py
+++ b/tests/custom-html/functional/test_content_roundtrip.py
@@ -27,7 +27,7 @@ def test_content_roundtrip(live_app):
filename = f"ccci-roundtrip-{uuid.uuid4().hex[:12]}.txt"
lifecycle.exec_in_app(
live_app,
- ["sh", "-c", f"printf %s {marker} > /srv/www/html/{filename}"],
+ ["sh", "-c", f"mkdir -p /srv/www/html && printf %s {marker} > /srv/www/html/{filename}"],
)
url = f"https://{live_app}/{filename}"
diff --git a/tests/custom-html/functional/test_content_type_header.py b/tests/custom-html/functional/test_content_type_header.py
index 8630ec2..0b2728f 100644
--- a/tests/custom-html/functional/test_content_type_header.py
+++ b/tests/custom-html/functional/test_content_type_header.py
@@ -40,7 +40,7 @@ def test_content_type_html_and_txt(live_app):
body = "hello"
for name in (html_name, txt_name):
lifecycle.exec_in_app(
- live_app, ["sh", "-c", f"printf %s {body} > /srv/www/html/{name}"]
+ live_app, ["sh", "-c", f"mkdir -p /srv/www/html && printf %s {body} > /srv/www/html/{name}"]
)
s_html, h_html = _head(f"https://{live_app}/{html_name}")
diff --git a/tests/custom-html/ops.py b/tests/custom-html/ops.py
index e729173..5fae7f6 100644
--- a/tests/custom-html/ops.py
+++ b/tests/custom-html/ops.py
@@ -14,7 +14,7 @@ MARKER_PATH = "/srv/www/html/ci-marker.txt"
def _write(domain: str, val: str) -> None:
- lifecycle.exec_in_app(domain, ["sh", "-c", f"echo {val} > {MARKER_PATH}"])
+ lifecycle.exec_in_app(domain, ["sh", "-c", f"mkdir -p $(dirname {MARKER_PATH}) && echo {val} > {MARKER_PATH}"])
def pre_upgrade(domain, meta):