Skip to content

[Subissue 4/7] E2E Black Box Test for Create Command #38

@josecelano

Description

@josecelano

Parent Epic: #34 - Implement Create Environment Command
Depends On: #37 - CLI Presentation Layer
Estimated Time: 3-4 hours

Overview

Implement a true black-box end-to-end test for the create command that tests the production application as an external process. Unlike other E2E tests that mock parts of the system, this test exercises the complete application workflow from configuration file to persisted environment state.

Goals

  • Create a true black-box E2E test that runs the production application as an external process
  • Test the complete workflow: config file → command execution → environment persistence
  • Use temporary directories for complete test isolation
  • Verify environment state is correctly persisted in the data folder
  • Add support for --working-dir optional argument to specify application working directory
  • Establish pattern for black-box testing that can be extended to other commands

Architecture Requirements

Test Type: Black Box E2E Test
Test Location: tests/e2e_create_command.rs (separate from existing E2E infrastructure)
Pattern: External Process Testing + Temporary Directory Isolation

Test Structure

tests/
├── e2e_create_command.rs     # New black-box E2E test
└── support/                  # Test support utilities
    ├── temp_workspace.rs     # Temporary workspace management
    ├── process_runner.rs     # External process execution
    └── assertions.rs         # Environment state assertions

Key Test Scenarios

  1. Happy Path: Create environment from valid config file with --working-dir
  2. Invalid Config: Graceful failure with validation errors
  3. Missing Config File: Appropriate error when file not found
  4. Duplicate Detection: Error when environment already exists
  5. State Persistence: Verify complete environment state saved correctly

Acceptance Criteria

  • Black-box test runs production binary as external process
  • Test uses TempDir for complete isolation (no ./data or ./build interference)
  • Test passes --working-dir to application to specify temporary workspace
  • All assertions check persisted state in the data directory
  • Test validates error messages are user-friendly and actionable
  • Test cleans up temporary directories automatically
  • Pattern is reusable for other command E2E tests

Implementation Notes

  • Use std::process::Command to run the production binary
  • Create TempWorkspace helper for managing temporary directories
  • Build configuration files in temp workspace before running command
  • Verify environment state by reading persisted JSON files
  • Follow patterns from existing E2E tests for consistency

For detailed specification, see: docs/issues/epic-create-environment-command-subissue-4-e2e-black-box-test.md

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions