Skip to content

Commit 1001bee

Browse files
committed
ci(workstation): add Lampstand runtime command smoke tests
1 parent d5f2e77 commit 1001bee

1 file changed

Lines changed: 47 additions & 1 deletion

File tree

.github/workflows/workstation-lampstand.yml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Checkout
2424
uses: actions/checkout@v4
2525

26-
- name: Syntax check installer
26+
- name: Syntax check installer and helper
2727
run: |
2828
set -euo pipefail
2929
bash -n profiles/linux-dev/workstation-v0/bin/install-lampstand.sh
@@ -59,3 +59,49 @@ jobs:
5959
svc="$tmp_home/.config/systemd/user/sourceos-lampstand.service"
6060
test -f "$svc"
6161
grep -F 'lampstandd --root %h --rpc unixjson' "$svc" >/dev/null
62+
63+
- name: Smoke: sourceos-search runtime commands with stub lampstand
64+
run: |
65+
set -euo pipefail
66+
helper='profiles/linux-dev/workstation-v0/bin/sourceos-search.sh'
67+
stub_bin=$(mktemp -d)
68+
cat > "$stub_bin/lampstand" <<'EOF'
69+
#!/usr/bin/env bash
70+
set -euo pipefail
71+
case "${1:-}" in
72+
query)
73+
printf '/tmp/example.txt\t(score=1.000)\n'
74+
printf ' snippet for %s\n' "$*"
75+
;;
76+
health)
77+
printf '{"ok": true, "service": "lampstand"}\n'
78+
;;
79+
stats)
80+
printf '{"documents": 1, "terms": 3}\n'
81+
;;
82+
index)
83+
printf '{"indexed": 1}\n'
84+
;;
85+
*)
86+
printf 'unexpected command: %s\n' "$*" >&2
87+
exit 2
88+
;;
89+
esac
90+
EOF
91+
chmod +x "$stub_bin/lampstand"
92+
93+
tmp_dir=$(mktemp -d)
94+
query_out="$tmp_dir/query.txt"
95+
health_out="$tmp_dir/health.json"
96+
stats_out="$tmp_dir/stats.json"
97+
98+
PATH="$stub_bin:$PATH" bash "$helper" --snippet --write "$query_out" report
99+
grep -F '/tmp/example.txt' "$query_out" >/dev/null
100+
101+
PATH="$stub_bin:$PATH" bash "$helper" health --write "$health_out"
102+
grep -F '"ok": true' "$health_out" >/dev/null
103+
104+
PATH="$stub_bin:$PATH" bash "$helper" stats --write "$stats_out"
105+
grep -F '"documents": 1' "$stats_out" >/dev/null
106+
107+
PATH="$stub_bin:$PATH" bash "$helper" index --root "$tmp_dir" >/dev/null

0 commit comments

Comments
 (0)