e27bbaaa43
Add an accept_until helper that only sends "y" when a new [Y/n] prompt appears in the tmux pane, replacing the fixed-count blind send loops that could race ahead of prompts or send stray input. Resilient to changes in the number of apply-phase prompts. Relates to #51 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
50 lines
1.2 KiB
Bash
Executable File
50 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Interactive test: accept all prompts (safety gate + hardening + signing skip)
|
|
# Verifies: all settings applied, re-audit exits 0
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
IFS=$'\n\t'
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
# shellcheck source=helpers.sh
|
|
source "${SCRIPT_DIR}/helpers.sh"
|
|
|
|
main() {
|
|
trap cleanup EXIT
|
|
|
|
printf 'Test: Full interactive apply (accept all)\n' >&2
|
|
|
|
start_session
|
|
|
|
# Safety review gate — answer yes
|
|
wait_for "reviewed this script"
|
|
send "y" Enter
|
|
|
|
# Proceed with hardening — answer yes
|
|
wait_for "Proceed with hardening"
|
|
send "y" Enter
|
|
|
|
# Accept all [Y/n] prompts until signing wizard
|
|
accept_until "Signing key options"
|
|
|
|
# Signing wizard — skip
|
|
wait_for "Signing key options" 20
|
|
send "s" Enter
|
|
|
|
# Wait for completion
|
|
sleep 2
|
|
capture_output >/dev/null 2>&1 || true
|
|
|
|
# Verify: re-run audit — signing won't pass (skipped) but git config should
|
|
if git config --global --get transfer.fsckObjects | grep -q true; then
|
|
pass "Full accept: git config settings applied (signing skipped as expected)"
|
|
else
|
|
fail "Full accept: settings not applied"
|
|
exit 1
|
|
fi
|
|
}
|
|
|
|
main
|