Files
computer-playbook/roles/web-svc-cdn/files/test/test.sh
kevinveenbirkenbachandClaude Opus 4.8 097794302c fix(web-svc-cdn): assert external flavor by absent compose stack, not leftover npm
The external-flavor CLI test checked for an npm/ dir under the served web root, but that bind source survives the inter-round purge, so a prior internal-flavor round left it behind and every later external round failed a false positive. Check the CDN compose instance dir (directories.instance) instead: it is purged between rounds and never recreated by the front-proxy-only external deploy, so it is present iff the build stack is actually deployed -- the real invariant the test means to assert.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-25 12:44:02 +02:00

39 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# E2E orchestrator for web-svc-cdn. Branches on the deployed CDN flavor:
# internal - the one-shot npm-mirror build ran, so the served CDN root holds
# the npm/ mirror tree (empty when no frontend-dep role is co-deployed).
# external - front-proxy only, so no CDN compose stack may be deployed.
# Variables sourced from test.env.j2 by test-e2e-cli.
set -euo pipefail
: "${CDN_TEST_FLAVOR:?}"
: "${CDN_TEST_IS_STACK_HOST:?}"
: "${CDN_TEST_WEB_ROOT:?}"
: "${CDN_TEST_STACK_DIR:?}"
if [[ "${CDN_TEST_IS_STACK_HOST}" != "true" ]]; then
echo "SKIP: not the stack host; web-svc-cdn only builds there"
exit 0
fi
npm_dir="${CDN_TEST_WEB_ROOT%/}/npm"
case "${CDN_TEST_FLAVOR}" in
internal)
if [[ ! -d "${npm_dir}" ]]; then
echo "FAIL: internal flavor but the one-shot build left no npm mirror at ${npm_dir}"
exit 1
fi
echo "OK: internal flavor built the npm mirror tree at ${npm_dir}"
;;
*)
if [[ -d "${CDN_TEST_STACK_DIR}" ]]; then
echo "FAIL: external flavor but the CDN build stack is deployed at ${CDN_TEST_STACK_DIR}"
exit 1
fi
echo "OK: external flavor served without the build stack (no ${CDN_TEST_STACK_DIR})"
;;
esac
echo "ALL CHECKS PASSED"