Skip to content

feat: [#188] implement test CLI command#189

Merged
josecelano merged 1 commit into
mainfrom
188-implement-test-cli-command
Nov 19, 2025
Merged

feat: [#188] implement test CLI command#189
josecelano merged 1 commit into
mainfrom
188-implement-test-cli-command

Conversation

@josecelano

@josecelano josecelano commented Nov 19, 2025

Copy link
Copy Markdown
Member

Description

Implements the presentation layer (CLI interface) for the test command, enabling users to verify deployment infrastructure through the command-line interface.

Changes

  • ✅ Add Test subcommand to CLI commands enum
  • ✅ Implement TestCommandController in presentation layer
  • ✅ Create TestSubcommandError with actionable help messages
  • ✅ Integrate test command with dispatch router
  • ✅ Add error conversions for CommandError
  • ✅ Update all CLI tests to handle Test command variant

Architecture

The test command validates deployment infrastructure by:

  • Verifying cloud-init completion
  • Checking Docker installation
  • Verifying Docker Compose installation

Follows the same architectural pattern as provision and configure commands with ExecutionContext pattern and direct dependency injection.

Module Structure

src/presentation/controllers/test/
├── mod.rs          # Module documentation and re-exports
├── handler.rs      # Main controller implementation
├── errors.rs       # Presentation-layer error types
└── tests/          # Unit tests for controller logic
    └── mod.rs

Testing

  • ✅ All pre-commit checks passing
  • ✅ Unit tests for error help messages
  • ✅ E2E tests passing
  • ⏳ Manual testing pending (see checklist below)

Manual Testing Checklist

Manual testing is required to verify the complete deployment workflow:

  • Step 1: Create environment
  • Step 2: Test before provision (should fail gracefully)
  • Step 3: Provision infrastructure
  • Step 4: Test after provision (should fail on Docker checks)
  • Step 5: Configure infrastructure
  • Step 6: Test after configure (should pass all validations)
  • Step 7: Test idempotency
  • Step 8: Test invalid environment name
  • Step 9: Test non-existent environment
  • Step 10: Cleanup

See full manual testing procedure in the issue specification.

Related

Usage Example

# Verify infrastructure after configuration
torrust-tracker-deployer test my-env

# Expected output on success:
[1/4] Validating environment... ✓
[2/4] Creating command handler... ✓
[3/4] Testing infrastructure... ✓
[4/4] Infrastructure validation completed successfully for 'my-env'

- Add Test subcommand to CLI commands enum
- Implement TestCommandController in presentation layer
- Create TestSubcommandError with actionable help messages
- Integrate test command with dispatch router
- Add error conversions for CommandError
- Update all CLI tests to handle Test command variant

The test command validates deployment infrastructure by:
- Verifying cloud-init completion
- Checking Docker installation
- Verifying Docker Compose installation

Follows the same architectural pattern as provision and configure
commands with ExecutionContext pattern and direct dependency injection.
@josecelano josecelano self-assigned this Nov 19, 2025
@josecelano

Copy link
Copy Markdown
Member Author

ACK cbc4a47

@josecelano josecelano merged commit b49af24 into main Nov 19, 2025
34 checks passed
@josecelano josecelano deleted the 188-implement-test-cli-command branch April 15, 2026 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement CLI Command: torrust-tracker-deployer test

1 participant