- common.sh: load_config() exports MOSAIC_DATA_ROOT/PROVIDER/MODEL; fails closed - compose.yaml: dataRoot mount and provider/model are required env (:? errors) - build/hello/verify load config before any mutation; no silent bootstrap - reset.sh: target resolved from configured dataRoot; all safety checks kept Verified: compose fails without launcher env; verify/reset fail on missing config; config-driven hello+verify pass; symlink refusal with sandboxed config (canary survived); config checksum unchanged across reset+rerun. Closes #2
56 lines
1.6 KiB
Bash
Executable File
56 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Complete verification test:
|
|
# 1. Build or confirm the image is built.
|
|
# 2. Run the agent request.
|
|
# 3. Remove surrounding whitespace from the response.
|
|
# 4. Compare with the expected marker (default MOSAIC_HELLO_OK).
|
|
# 5. Exit 0 only on exact match; nonzero otherwise.
|
|
#
|
|
# EXPECTED_MARKER may be overridden to prove the failure path
|
|
# (acceptance criterion 9), e.g.:
|
|
# EXPECTED_MARKER=MOSAIC_NOT_OK scripts/verify.sh
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
# shellcheck source=common.sh
|
|
source scripts/common.sh
|
|
|
|
IMAGE="mosaic-poc-agent:0.84.4"
|
|
EXPECTED="${EXPECTED_MARKER:-MOSAIC_HELLO_OK}"
|
|
|
|
load_config
|
|
|
|
# 1. Build the image only if it is not already present.
|
|
if ! docker image inspect "$IMAGE" >/dev/null 2>&1; then
|
|
echo "verify: image $IMAGE not found, building..." >&2
|
|
bootstrap_runtime_dir
|
|
docker compose build
|
|
fi
|
|
|
|
# 2. Run the agent request (stdout only = model response).
|
|
set +e
|
|
RESPONSE="$(docker compose run --rm -T mosaic-agent 2>/tmp/mosaic-poc-stderr.$$)"
|
|
RC=$?
|
|
set -e
|
|
STDERR_FILE="/tmp/mosaic-poc-stderr.$$"
|
|
if [ $RC -ne 0 ]; then
|
|
echo "verify: agent run failed (exit $RC):" >&2
|
|
cat "$STDERR_FILE" >&2
|
|
rm -f "$STDERR_FILE"
|
|
exit 1
|
|
fi
|
|
rm -f "$STDERR_FILE"
|
|
|
|
# 3. Remove surrounding whitespace.
|
|
TRIMMED="$(printf '%s' "$RESPONSE" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
|
|
|
|
# 4-6. Exact comparison gate.
|
|
if [ "$TRIMMED" = "$EXPECTED" ]; then
|
|
echo "PASS: response matches expected marker"
|
|
exit 0
|
|
fi
|
|
|
|
echo "FAIL: response does not match expected marker" >&2
|
|
printf 'expected: %s\n' "$EXPECTED" >&2
|
|
printf 'actual : %s\n' "$TRIMMED" >&2
|
|
exit 1
|