ScuttleBot

scuttlebot / tests / smoke / test-installers.sh
Blame History Raw 105 lines
1
#!/usr/bin/env bash
2
# Smoke test for scuttlebot relay installers.
3
4
set -euo pipefail
5
6
REPO_ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/../.." && pwd)
7
TEMP_HOME=$(mktemp -d)
8
export HOME="$TEMP_HOME"
9
export SCUTTLEBOT_CONFIG_FILE="$HOME/.config/scuttlebot-relay.env"
10
export CODEX_HOOKS_DIR="$HOME/.codex/hooks"
11
export CODEX_HOOKS_JSON="$HOME/.codex/hooks.json"
12
export CODEX_CONFIG_TOML="$HOME/.codex/config.toml"
13
export CODEX_BIN_DIR="$HOME/.local/bin"
14
export GEMINI_HOOKS_DIR="$HOME/.gemini/hooks"
15
export GEMINI_SETTINGS_JSON="$HOME/.gemini/settings.json"
16
export GEMINI_BIN_DIR="$HOME/.local/bin"
17
export CLAUDE_HOOKS_DIR="$HOME/.claude/hooks"
18
export CLAUDE_SETTINGS_JSON="$HOME/.claude/settings.json"
19
export CLAUDE_BIN_DIR="$HOME/.local/bin"
20
21
printf 'Smoke testing installers in %s...\n' "$TEMP_HOME"
22
23
mkdir -p "$HOME/.config"
24
cat > "$SCUTTLEBOT_CONFIG_FILE" <<'EOF'
25
SCUTTLEBOT_IRC_PASS=stale-pass
26
EOF
27
28
# Mock binaries
29
mkdir -p "$HOME/.local/bin"
30
touch "$HOME/.local/bin/codex" "$HOME/.local/bin/gemini" "$HOME/.local/bin/claude"
31
chmod +x "$HOME/.local/bin/codex" "$HOME/.local/bin/gemini" "$HOME/.local/bin/claude"
32
export PATH="$HOME/.local/bin:$PATH"
33
34
# 1. Codex
35
printf 'Testing Codex installer...\n'
36
bash "$REPO_ROOT/skills/openai-relay/scripts/install-codex-relay.sh" \
37
--url http://localhost:8080 \
38
--token "test-token" \
39
--channel general \
40
--channels general,task-42
41
42
# Verify files
43
[ -f "$HOME/.codex/hooks/scuttlebot-post.sh" ]
44
[ -f "$HOME/.codex/hooks/scuttlebot-check.sh" ]
45
[ -f "$HOME/.codex/hooks.json" ]
46
[ -f "$HOME/.codex/config.toml" ]
47
[ -f "$HOME/.local/bin/codex-relay" ]
48
[ -f "$HOME/.config/scuttlebot-relay.env" ]
49
! grep -q '^SCUTTLEBOT_IRC_PASS=' "$SCUTTLEBOT_CONFIG_FILE"
50
grep -q '^SCUTTLEBOT_IRC_DELETE_ON_CLOSE=1$' "$SCUTTLEBOT_CONFIG_FILE"
51
grep -q '^SCUTTLEBOT_CHANNELS=general,task-42$' "$SCUTTLEBOT_CONFIG_FILE"
52
53
# 2. Gemini
54
printf 'Testing Gemini installer...\n'
55
bash "$REPO_ROOT/skills/gemini-relay/scripts/install-gemini-relay.sh" \
56
--url http://localhost:8080 \
57
--token "test-token" \
58
--channel general \
59
--channels general,release \
60
--irc-pass "gemini-fixed"
61
62
# Verify files
63
[ -f "$HOME/.gemini/hooks/scuttlebot-post.sh" ]
64
[ -f "$HOME/.gemini/hooks/scuttlebot-check.sh" ]
65
[ -f "$HOME/.gemini/settings.json" ]
66
[ -f "$HOME/.local/bin/gemini-relay" ]
67
grep -q '^SCUTTLEBOT_IRC_PASS=gemini-fixed$' "$SCUTTLEBOT_CONFIG_FILE"
68
grep -q '^SCUTTLEBOT_CHANNELS=general,release$' "$SCUTTLEBOT_CONFIG_FILE"
69
70
printf 'Testing Gemini auto-register scrub...\n'
71
bash "$REPO_ROOT/skills/gemini-relay/scripts/install-gemini-relay.sh" \
72
--channel general \
73
--auto-register
74
! grep -q '^SCUTTLEBOT_IRC_PASS=' "$SCUTTLEBOT_CONFIG_FILE"
75
76
# 3. Claude
77
printf 'Testing Claude installer...\n'
78
bash "$REPO_ROOT/skills/scuttlebot-relay/scripts/install-claude-relay.sh" \
79
--url http://localhost:8080 \
80
--token "test-token" \
81
--channel general \
82
--channels general,ops \
83
--transport irc \
84
--irc-addr 127.0.0.1:6667 \
85
--irc-pass "claude-fixed"
86
87
# Verify files
88
[ -f "$HOME/.claude/hooks/scuttlebot-post.sh" ]
89
[ -f "$HOME/.claude/hooks/scuttlebot-check.sh" ]
90
[ -f "$HOME/.claude/settings.json" ]
91
[ -f "$HOME/.local/bin/claude-relay" ]
92
grep -q '^SCUTTLEBOT_IRC_PASS=claude-fixed$' "$SCUTTLEBOT_CONFIG_FILE"
93
grep -q '^SCUTTLEBOT_TRANSPORT=irc$' "$SCUTTLEBOT_CONFIG_FILE"
94
grep -q '^SCUTTLEBOT_CHANNELS=general,ops$' "$SCUTTLEBOT_CONFIG_FILE"
95
96
printf 'Testing Claude auto-register scrub...\n'
97
bash "$REPO_ROOT/skills/scuttlebot-relay/scripts/install-claude-relay.sh" \
98
--channel general \
99
--auto-register
100
! grep -q '^SCUTTLEBOT_IRC_PASS=' "$SCUTTLEBOT_CONFIG_FILE"
101
102
printf 'ALL INSTALLERS PASSED SMOKE TEST\n'
103
chmod -R +w "$TEMP_HOME"
104
rm -rf "$TEMP_HOME"
105

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button