#!/usr/bin/env bash
# Use production Python/dependencies with current source, without credentials or network.
set -euo pipefail
bot=/srv/kiln-bot
image_id=$(docker inspect --format '{{.Image}}' kiln-bot-bot-1)
mounts=()
for name in main.py bots.py notify.py config.py log_security.py miniapp.py booking_tables.py booking_policy.py booking_refunds.py order_policy.py order_policy_store.py native_order.py customer_access.py activity.py schema.sql tests sbis_templates; do
    mounts+=(--mount "type=bind,src=$bot/$name,dst=/app/$name,readonly")
done
docker run --rm --network none --read-only --tmpfs /tmp:rw,size=32m \
    --workdir /app "${mounts[@]}" --entrypoint python "$image_id" \
    -B -m unittest discover -s tests -q
