Agent skill
testing-interactive-gpg
Test the installer's interactive GPG key setup using an expect script that automates GPG prompts. Use when (1) testing GPG key generation end-to-end, (2) verifying the installer handles GPG prompts correctly, (3) debugging GPG-related failures in CI or containers, or (4) modifying the GPG setup flow and needing to validate it interactively.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/testing-interactive-gpg
SKILL.md
Interactive GPG Testing
Test the installer's GPG key setup flow using an expect script (installer/test-interactive-gpg.exp) that automates responses to GPG's interactive prompts.
Why This Exists
GPG key generation is fully interactive — it prompts for email, name, passphrase, key type, and confirmations. The installer runs GPG in passthrough mode, so these prompts reach the terminal directly. Automated testing requires an expect script to respond to them.
Prerequisites
Check if expect is available, and install it if not:
command -v expect || brew install expect # macOS
command -v expect || sudo apt-get install expect # Ubuntu/Debian
command -v expect || sudo dnf install expect # Fedora
Usage
Run from the installer/ directory (or provide the full path to the binary):
./test-interactive-gpg.exp [installer_path] [email] [name] [passphrase] [branch] [verbosity]
All arguments are optional and have defaults:
| Argument | Default | Description |
|---|---|---|
installer_path |
./dotfiles-installer |
Path to the installer binary |
email |
[email protected] |
GPG key email address |
name |
Test CI User |
GPG key full name |
passphrase |
test-ci-passphrase |
GPG key passphrase |
branch |
(empty) | Git branch for --git-branch flag |
verbosity |
(empty) | Verbosity flag (e.g., -v, -vv) |
Examples
# Default values — good for quick smoke tests
./test-interactive-gpg.exp
# Custom GPG identity
./test-interactive-gpg.exp ./dotfiles-installer "[email protected]" "Your Name" "your-passphrase"
# Test a specific branch with verbose output
./test-interactive-gpg.exp ./dotfiles-installer "" "" "" feature-branch -vv
# Use a binary from goreleaser dist (in Docker container)
./test-interactive-gpg.exp \
./dist/dotfiles_installer_linux_arm64_v8.0/dotfiles-installer \
"[email protected]" "Test User" "test-passphrase"
How It Works
The script spawns the installer with install --plain --install-prerequisites=true --git-clone-protocol=https and then enters an expect loop that matches GPG prompts by regex:
- Email/name/passphrase — responds with the provided arguments
- Key type, size, expiration — accepts defaults (RSA, default size, no expiration)
- Comment field — skips (empty)
- Confirmation prompts (
(O)kay) — sendsO - Errors — logs but continues (some errors are expected in CI)
- Timeout — fails after 300 seconds
The script exits with the installer's exit code.
Testing in Docker Containers
Combine with the testing-e2e-containers skill workflow:
- Build the binary:
cd installer && goreleaser build --skip before --snapshot --clean - Start a container:
cd installer/docker && task ubuntu:start - Copy or mount the expect script and run it inside the container
- Tear down:
task ubuntu:stop
See the testing-e2e-containers skill for container management details.
Debugging
If the script hangs or mismatches a prompt:
- Enable debug mode: edit the script and set
exp_internal 1(line withexp_internal 0) - Run manually and observe the exact prompt text GPG produces
- Add or adjust regex patterns in the
expectblock to match new prompt formats
Common issues:
- GPG errors in containers — expected in minimal container environments; the script logs and continues
- Timeout — GPG key generation can be slow without entropy; ensure the container has enough (
rng-toolsorhavegedcan help) - Unmatched prompts — GPG prompt text varies by version; use case-insensitive regex patterns
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?