mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-08-27 14:17:10 -04:00
Centralize Docker / CI e2e test helpers so per-command suites can be declarative and future commands (install, wrap, ...) can reuse the same shim/PATH/assertion primitives without duplicating infrastructure. The harness provides: * Case dataclass describing one test as argv + shims + expected exit / stdout / stderr / files / custom callbacks * make_shim() factory producing cross-platform executable shims (.sh on POSIX, .cmd on Windows) with noop / fail / record-args behaviors * with_clean_path() context manager that isolates PATH to a minimal known-good value plus any extras supplied by the case * agent_settings_path() locator mirroring headroom.cli.init so tests can assert the right file was written without touching private init state * run_cases() for independent cases and run_case_sequence() for cases that must share scratch state (e.g. manifest-merge scenarios) Shell / PowerShell shim-creation scripts are also shipped for CI steps that need to drop a shim without spinning up Python first. No behavior change in this commit - pure infrastructure. The init suite and new subcommand suites consume the harness in follow-up commits. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
28 lines
491 B
Bash
28 lines
491 B
Bash
#!/usr/bin/env bash
|
|
# Create a noop executable shim at $2/$1 suitable for use in PATH during
|
|
# native (non-Docker) e2e tests. Mirrors e2e/_lib/shims.py make_shim(noop).
|
|
#
|
|
# Usage: make_shim.sh <name> <dir>
|
|
#
|
|
# Exit codes:
|
|
# 0 on success
|
|
# 2 on usage error
|
|
|
|
set -euo pipefail
|
|
|
|
if [ $# -ne 2 ]; then
|
|
echo "usage: $0 <name> <dir>" >&2
|
|
exit 2
|
|
fi
|
|
|
|
name="$1"
|
|
dir="$2"
|
|
|
|
mkdir -p "$dir"
|
|
path="$dir/$name"
|
|
cat >"$path" <<'EOS'
|
|
#!/usr/bin/env bash
|
|
exit 0
|
|
EOS
|
|
chmod +x "$path"
|
|
echo "$path"
|