File size: 2,078 Bytes
c20f20c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/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}"