arena-learning / scripts /smoke-test.sh
Nitish kumar
Upload folder using huggingface_hub
c20f20c verified
#!/bin/bash
# IniClaw + OpenMAIC Integration Smoke Test
set -e
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m'
INICLAW_URL=${INICLAW_GATEWAY_URL:-"http://localhost:7070"}
OPENMAIC_URL=${OPENMAIC_URL:-"http://localhost:3000"}
SECRET=${BRIDGE_SECRET:-"changeme_replace_with_output_of_openssl_rand_hex_16"}
echo "--- 1. Checking IniClaw Health ---"
curl -fsSL "$INICLAW_URL/health" | grep -q "ok"
echo -e "${GREEN}βœ“ IniClaw is alive${NC}"
echo "--- 2. Checking OpenMAIC Proxy Health ---"
curl -fsSL "$OPENMAIC_URL/api/iniclaw-health" | grep -q "connected" || echo -e "${RED}⚠ OpenMAIC reports IniClaw disconnected (expected if IniClaw is not running)${NC}"
echo -e "${GREEN}βœ“ OpenMAIC health endpoint checked${NC}"
echo "--- 3. Testing IniClaw Agent (Mocked) ---"
# This will likely 500 because openshell is missing, but we check if it hits the gateway
RESPONSE=$(curl -s -X POST "$INICLAW_URL/agent" \
-H "Authorization: Bearer $SECRET" \
-H "Content-Type: application/json" \
-d '{"message": "smoke test", "sessionId": "smoke-sid"}')
if echo "$RESPONSE" | grep -q "openshell: command not found"; then
echo -e "${GREEN}βœ“ IniClaw gateway received request and attempted execution (found error as expected)${NC}"
elif echo "$RESPONSE" | grep -q "status"; then
echo -e "${GREEN}βœ“ IniClaw agent responded successfully${NC}"
else
echo -e "${RED}βœ— Unexpected response from IniClaw: $RESPONSE${NC}"
fi
echo "--- 4. Verifying Audit Log ---"
if [ -f "ini_claw/.classroom-cache/audit.jsonl" ]; then
LOG_FILE="ini_claw/.classroom-cache/audit.jsonl"
elif [ -f ".classroom-cache/audit.jsonl" ]; then
LOG_FILE=".classroom-cache/audit.jsonl"
elif [ -f "../ini_claw/.classroom-cache/audit.jsonl" ]; then
LOG_FILE="../ini_claw/.classroom-cache/audit.jsonl"
fi
if [ -n "$LOG_FILE" ]; then
grep -q "smoke test" "$LOG_FILE" && echo -e "${GREEN}βœ“ Audit log contains smoke test entry${NC}" || echo -e "${RED}βœ— Audit log missing smoke test entry${NC}"
else
echo -e "${RED}βœ— Audit log file not found${NC}"
fi
echo -e "\n${GREEN}SMOKE TEST COMPLETE${NC}"