Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 22, 2025

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix E2E Infrastructure Preservation</issue_title>
<issue_description># Fix E2E Infrastructure Preservation

Type: Task
Priority: High
Parent Epic: #10 - UI Layer Destroy Command
Estimated Effort: 1-2 hours


📋 Issue Overview

Restore the --keep flag functionality in E2E test binaries to preserve infrastructure for manual testing workflows. This is a prerequisite for testing the destroy CLI command implementation.

🎯 Problem Statement

During E2E binary refactoring, the new run_infrastructure_destroy function doesn't respect the --keep CLI argument. This breaks the ability to preserve test infrastructure for manual verification, which is essential for testing the destroy CLI command.

Current Broken Workflow

# This should preserve infrastructure but doesn't
cargo run --bin e2e-tests-full -- --keep
cargo run --bin e2e-provision-and-destroy-tests -- --keep

# Infrastructure gets destroyed despite --keep flag

Required Manual Testing Workflow

# 1. Provision infrastructure and keep it
cargo run --bin e2e-provision-and-destroy-tests -- --keep

# Verify infrastructure is preserved
ls data/e2e-provision/          # Should exist
ls build/e2e-provision/         # Should exist
lxc list | grep e2e-provision   # Should show VM running

# 2. Manually test destroy CLI command (when implemented)
torrust-tracker-deployer destroy e2e-provision

# 3. Verify complete cleanup using LXD commands (see docs/tech-stack/lxd.md)
ls data/e2e-provision/          # Should not exist
ls build/e2e-provision/         # Should not exist  
lxc list | grep e2e-provision   # Should return nothing (VM destroyed)

🎯 Goals

  1. Fix --keep flag functionality in both E2E test binaries
  2. Ensure run_infrastructure_destroy function respects the keep parameter
  3. Enable reliable manual testing workflow for destroy CLI command
  4. Maintain existing E2E test behavior when --keep is not used

📦 Scope

Files to Fix

  • src/bin/e2e_tests_full.rs - Main E2E test binary
  • src/bin/e2e_provision_and_destroy_tests.rs - Provision/destroy E2E binary
  • Any helper functions that handle infrastructure cleanup

✅ Acceptance Criteria

Functional Requirements

  • --keep flag in e2e_tests_full.rs preserves infrastructure as intended
  • --keep flag in e2e_provision_and_destroy_tests.rs preserves infrastructure as intended
  • run_infrastructure_destroy function respects the keep parameter correctly
  • Manual testing workflow works:
    • Run E2E test with --keep → infrastructure preserved (data/, build/, LXD VM)
    • Can manually test destroy CLI command on preserved infrastructure
    • Can verify complete cleanup after manual destroy command using LXD commands
    • LXD VM verification works: lxc list | grep e2e-provision shows VM when preserved, nothing when destroyed
  • All E2E tests still pass when --keep flag is not used (default behavior unchanged)

Testing Requirements

  • Unit tests for CLI argument parsing with --keep flag

  • Integration test verifying infrastructure preservation

  • E2E test verifying default destruction behavior (no --keep)

  • Manual testing verification:

    # Test with --keep
    cargo run --bin e2e-provision-and-destroy-tests -- --keep
    # Verify infrastructure exists in data/ and build/
    lxc list | grep e2e-provision  # Should show VM running
    
    # Test without --keep (default)
    cargo run --bin e2e-provision-and-destroy-tests
    # Verify infrastructure is cleaned up
    lxc list | grep e2e-provision  # Should return nothing

🔗 Related Issues

📚 Related Documentation


Full specification: See docs/issues/fix-e2e-infrastructure-preservation.md</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #21


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@josecelano
Copy link
Member

An API call error occurred, and the issue was incorrectly assigned to @copilot twice. The new one is #26

@josecelano josecelano closed this Oct 22, 2025
Copilot AI requested a review from josecelano October 22, 2025 14:38
Copilot finished work on behalf of josecelano October 22, 2025 14:39
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.

Fix E2E Infrastructure Preservation

2 participants