Docker testing provides an isolated Linux environment for testing APS installation, setup, and workflows from a user's perspective. This approach ensures that APS works correctly on a clean Linux machine without affecting the developer's local environment.
- Isolation: Clean environment for every test run
- Realism: Simulates actual user machine setup
- Reproducibility: Consistent test conditions across all developers
- Linux Testing: Tests on target Linux platform regardless of host OS
- No Local Impact: Keeps local development environment clean
- Easy Cleanup: One-command cleanup of all test artifacts
- User Journey Testing: Simulate complete user workflows
- Installation Testing: Verify binary installation and setup
- Cross-Platform Testing: Test Linux behavior from macOS/Windows hosts
- CI/CD Integration: Automated testing in GitHub Actions
- Manual Testing: Interactive environment for debugging
Docker Container (aps-test-env)
├── /home/testuser/ # User home directory (persistent volume)
│ ├── .config/aps/ # APS config (persistent volume)
│ └── .local/ # Local data
├── /host-src/ # Project source (read-only mount)
│ ├── bin/aps # Built binary
│ └── tests/fixtures/ # Test fixtures
└── /test-fixtures/ # Test fixtures (read-only mount)
- Base Image: Ubuntu 22.04 (matches default container isolation base)
- User: Non-root user
testuserfor realistic environment - Volumes: Three persistent volumes for state management
- Mounts: Read-only mounts for project source and fixtures
Objective: Verify binary installation and basic availability
Tests:
- Binary exists in PATH
- Version command works
- Help command works
- Binary is executable
Script: tests/fixtures/scripts/01-installation.sh
Objective: Verify APS first-time setup and profile creation
Tests:
- XDG directory structure creation
- Profile creation with various options
- Profile listing
- Profile details display
- Profile deletion
Script: tests/fixtures/scripts/02-initial-setup.sh
Objective: Verify command execution and environment isolation
Tests:
- Basic command execution
- Environment variable injection (APS_PROFILE_ID)
- Multiple command chaining
- Output verification
Script: tests/fixtures/scripts/03-workflow-execution.sh
Objective: Verify profile configuration updates
Tests:
- Profile updates (capabilities, settings)
- Configuration persistence
- Profile listing with filters
Script: tests/fixtures/scripts/04-configuration-management.sh
Objective: Verify profile cleanup and deletion
Tests:
- Multiple profile creation and deletion
- Profile verification after deletion
- Config directory cleanup
Script: tests/fixtures/scripts/05-cleanup-operations.sh
# Run complete test suite
make docker-test-e2e-userThis executes all test scripts in sequence with a summary report.
# Start test container
make docker-test-up
# Install binary
make docker-test-install
# Enter container
make docker-test-shell
# Run manual tests
aps --help
aps profile create test-agent
aps run test-agent -- echo "Hello"
# Exit and cleanup
exit
make docker-test-down| Target | Description |
|---|---|
docker-build-test |
Build Docker test image |
docker-test-up |
Start test container in background |
docker-test-down |
Stop and remove test containers |
docker-test-shell |
Start interactive shell in test container |
docker-test-install |
Install built binary in test container |
docker-test-e2e-user |
Run full user journey test suite |
docker-test-cleanup |
Clean up all Docker test artifacts |
docker-quick-start |
Quick start guide for first-time users |
Typical testing workflow:
# 1. Build local binary
make build
# 2. Build test image (first time only)
make docker-build-test
# 3. Install binary in container
make docker-test-install
# 4. Run tests
make docker-test-e2e-user
# 5. Cleanup (optional)
make docker-test-cleanupLocation: tests/fixtures/profiles/
- basic-profile.yaml: Simple profile with basic capabilities
- dev-profile.yaml: Development profile with additional tools
Location: tests/fixtures/secrets/
- test-secrets.env: Non-sensitive test secrets for testing secret management
Location: tests/fixtures/scripts/
All scripts are executable and follow these conventions:
set -efor error handling- Clear output with section markers
- Return 0 on success, non-zero on failure
- Cleanup of test artifacts
File: .github/workflows/docker-user-journey.yml
Job: docker-user-journey
Platform: Ubuntu latest
Steps:
- Checkout code
- Set up Go
- Download dependencies
- Build binary
- Build test image
- Install binary in container
- Run user journey tests
- Cleanup (always)
Automatic:
- Push to main/develop branches
- Pull requests to main/develop branches
Manual:
gh workflow run docker-user-journey.yml
Error: Cannot connect to Docker daemon
Solution:
# macOS/Windows: Start Docker Desktop
# Linux: sudo systemctl start docker
docker infoError: aps: command not found
Solution:
# Build binary locally
make build
# Install in container
make docker-test-installError: Container exists or conflicts
Solution:
# Stop and remove existing container
make docker-test-down
# Try again
make docker-test-upIssue: Old test data interfering
Solution:
# Complete cleanup with volume removal
make docker-test-down -v
# Or full cleanup
make docker-test-cleanupFor debugging test failures:
-
Run individual test script:
docker compose -f docker-compose.test.yml run --rm test-env \ /test-fixtures/scripts/02-initial-setup.sh -
Enter container and run manually:
make docker-test-shell bash /test-fixtures/scripts/02-initial-setup.sh
-
Check container logs:
docker logs aps-test-container
- First build: ~2-3 minutes (includes image build)
- Subsequent builds: ~30 seconds (binary only)
- Test execution: ~10-20 seconds for full suite
- Memory: ~500MB (container overhead + APS)
- Disk: ~2GB (Ubuntu base + APS + dependencies)
- CPU: Minimal during idle, moderate during builds
- Reuse volumes: Keep containers running for multiple test runs
- Parallel testing: Use
t.Parallel()in test scripts (with unique IDs) - Minimal base: Use Alpine Linux if Ubuntu isn't required
- Layer caching: Optimize Dockerfile for layer reuse
When APS requirements change:
- Update
Dockerfile.testif dependencies change - Update test fixtures if profile schema changes
- Add new test scripts for new features
- Update this documentation
- Tag test images:
docker build -t aps-test-env:v1.0.0 - Use specific versions: Update
docker-compose.test.yml - Track changes in release notes
- Always test locally before pushing
- Run full suite after significant changes
- Clean up between major test iterations
- Document any new test scenarios
- Use unique IDs to avoid conflicts in parallel tests
- Cleanup after each test
- Provide clear output for debugging
- Return proper exit codes for automation
- Cache dependencies to speed up builds
- Run on all platforms (Linux, macOS, Windows)
- Cleanup artifacts to save space
- Fail fast on first error
- Docker Testing for Users - User-facing testing guide
- Container Platform Overview - Container isolation with testing section
- CI/CD Setup - CI/CD integration
Potential improvements:
- Multi-container testing: Test agent-to-agent communication
- Service mocking: Test webhooks and external services
- Performance testing: Benchmark within Docker environment
- Security testing: Test isolation boundaries
- Network testing: Test network configurations and DNS
Last Updated: January 30, 2026 Version: 1.0.0