From 3d5b1f44a65b14c9445995d4594e0301f5d6c716 Mon Sep 17 00:00:00 2001 From: Frank Date: Wed, 16 Sep 2026 06:57:22 -0700 Subject: [PATCH] tests: fix the comfyui Containerfile test instead of living with it red MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test failed on a clean tree for many sessions, and the working belief became "test 73 is a known failure, ignore it" — which is exactly what a permanently red suite teaches. The cause was a selector bug: `find dankclaw -name 'Containerfile*' | head -1` returned whichever Containerfile the directory listing happened to put first (dankclaw/alloy/Containerfile), so the assertion read a file that never claimed to be ComfyUI's. It would equally have passed on a wrong file. The test now resolves the Containerfile the way the build does — build.context joined with build.dockerfile, both read from dankclaw/compose.yaml — so it checks the file the deploy actually builds (dankclaw/Containerfile.comfyui, the one compose, deploy-remote.sh and the ComfyUI doc all name) and follows a future rename instead of guessing. Suite: ALL TESTS PASSED (310), no exceptions to explain away. --- tests/comfyui_rocm.bats | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/comfyui_rocm.bats b/tests/comfyui_rocm.bats index 913f2d1..783e3db 100644 --- a/tests/comfyui_rocm.bats +++ b/tests/comfyui_rocm.bats @@ -34,9 +34,26 @@ PYEOF } @test "comfyui Containerfile is based on the gfx1151 torch image" { + # Resolve the Containerfile the way the build does — build.context joined + # with build.dockerfile — rather than asking the filesystem. A + # `find … | head -1` here returned whichever Containerfile the directory + # listing happened to put first (dankclaw/alloy/Containerfile), so the test + # failed for sessions while the real ComfyUI Containerfile was correct — and + # it would equally have passed on a wrong file. local cf - cf=$(find "$REPO_ROOT/dankclaw" -name 'Containerfile*' 2>/dev/null | head -1) - [ -n "$cf" ] || { echo "no Containerfile under dankclaw/"; return 1; } + cf=$(python3 - "$REPO_ROOT/dankclaw/compose.yaml" "$REPO_ROOT/dankclaw" <<'PYEOF' +import os, sys, yaml +with open(sys.argv[1]) as fh: + svc = yaml.safe_load(fh)["services"]["comfyui"] +build = svc.get("build") or {} +# Compose resolves dockerfile relative to context, context relative to the +# compose file's own directory. +print(os.path.normpath(os.path.join( + sys.argv[2], build.get("context", "."), build.get("dockerfile", "Containerfile")))) +PYEOF +) + [ -n "$cf" ] || { echo "could not resolve the comfyui Containerfile"; return 1; } + [ -f "$cf" ] || { echo "$cf (from compose build) does not exist"; return 1; } grep -q "gfx1151" "$cf" || { echo "$cf does not reference gfx1151"; return 1; } grep -q "FROM" "$cf" || { echo "$cf has no FROM"; return 1; } }