Files
computer-playbook/scripts/tests/code.sh
T
kevinveenbirkenbach 4e0d09e773 refactor(dev-orchestrator): centralize image build and add up --when-down SPOT
- Introduce cli.deploy.development build subcommand as single build SPOT
- Remove legacy compose.build_infinito implementation
- Make up use build-missing logic via build handler
- Add --when-down flag to up (skip startup if stack already running)
- Simplify restart/run to reuse up handler
- Ensure tests use up --when-down to avoid stack interference
- Make test targets depend on build-missing

https://chatgpt.com/share/696fd3c9-99f0-800f-a0ab-33a91058419a
2026-01-20 20:13:02 +01:00

38 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
echo "============================================================"
echo ">>> Running UNIT tests in ${INFINITO_DISTRO:-<unset>} container (compose stack)"
echo "============================================================"
: "${INFINITO_DISTRO:?INFINITO_DISTRO must be set}"
: "${TEST_PATTERN:?TEST_PATTERN must be set}"
: "${TEST_TYPE:?TEST_TYPE must be set}"
python3 -m cli.deploy.development up --when-down
# 2) Run tests inside the already running infinito container via the new exec wrapper.
# We keep the old NIX_CONFIG behavior (flake config acceptance) but run it inside the container.
python3 -m cli.deploy.development exec \
--distro "${INFINITO_DISTRO}" -- \
bash -lc "
set -euo pipefail
NIX_CONFIG_EFFECTIVE=\"\$(
printf '%s\n%s\n' \
\"\${NIX_CONFIG:-}\" \
'accept-flake-config = true' \
| sed -e 's/[[:space:]]\\+$//' -e '/^$/d'
)\"
export NIX_CONFIG=\"\${NIX_CONFIG_EFFECTIVE}\"
cd /opt/src/infinito
echo \"PWD=\$(pwd)\"
echo \"PYTHON=\${PYTHON}\"
export PATH=\"\$(dirname \"\$PYTHON\"):\$PATH\"
make setup
\"\$PYTHON\" -m unittest discover -s tests/${TEST_TYPE} -t . -p \"${TEST_PATTERN}\"
"