|
23 | 23 | - name: Checkout |
24 | 24 | uses: actions/checkout@v4 |
25 | 25 |
|
26 | | - - name: Syntax check installer |
| 26 | + - name: Syntax check installer and helper |
27 | 27 | run: | |
28 | 28 | set -euo pipefail |
29 | 29 | bash -n profiles/linux-dev/workstation-v0/bin/install-lampstand.sh |
|
59 | 59 | svc="$tmp_home/.config/systemd/user/sourceos-lampstand.service" |
60 | 60 | test -f "$svc" |
61 | 61 | 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