test: add script to verify Dockerfile builds and nanobot status works
Builds the image, runs onboard + status inside the container, and validates that the expected output fields (Config, Workspace, Model, API keys) are present. https://claude.ai/code/session_011C1h1NERqqZp4ht3Pqpwkc
This commit is contained in:
55
test_docker.sh
Executable file
55
test_docker.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
IMAGE_NAME="nanobot-test"
|
||||
|
||||
echo "=== Building Docker image ==="
|
||||
docker build -t "$IMAGE_NAME" .
|
||||
|
||||
echo ""
|
||||
echo "=== Running 'nanobot onboard' ==="
|
||||
docker run --name nanobot-test-run "$IMAGE_NAME" onboard
|
||||
|
||||
echo ""
|
||||
echo "=== Running 'nanobot status' ==="
|
||||
STATUS_OUTPUT=$(docker commit nanobot-test-run nanobot-test-onboarded > /dev/null && \
|
||||
docker run --rm nanobot-test-onboarded status 2>&1) || true
|
||||
|
||||
echo "$STATUS_OUTPUT"
|
||||
|
||||
echo ""
|
||||
echo "=== Validating output ==="
|
||||
PASS=true
|
||||
|
||||
check() {
|
||||
if echo "$STATUS_OUTPUT" | grep -q "$1"; then
|
||||
echo " PASS: found '$1'"
|
||||
else
|
||||
echo " FAIL: missing '$1'"
|
||||
PASS=false
|
||||
fi
|
||||
}
|
||||
|
||||
check "nanobot Status"
|
||||
check "Config:"
|
||||
check "Workspace:"
|
||||
check "Model:"
|
||||
check "OpenRouter API:"
|
||||
check "Anthropic API:"
|
||||
check "OpenAI API:"
|
||||
|
||||
echo ""
|
||||
if $PASS; then
|
||||
echo "=== All checks passed ==="
|
||||
else
|
||||
echo "=== Some checks FAILED ==="
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Cleanup
|
||||
echo ""
|
||||
echo "=== Cleanup ==="
|
||||
docker rm -f nanobot-test-run 2>/dev/null || true
|
||||
docker rmi -f nanobot-test-onboarded 2>/dev/null || true
|
||||
docker rmi -f "$IMAGE_NAME" 2>/dev/null || true
|
||||
echo "Done."
|
||||
Reference in New Issue
Block a user