-
Notifications
You must be signed in to change notification settings - Fork 0
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 flagRequired 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
- Fix
--keepflag functionality in both E2E test binaries - Ensure
run_infrastructure_destroyfunction respects thekeepparameter - Enable reliable manual testing workflow for destroy CLI command
- Maintain existing E2E test behavior when
--keepis not used
📦 Scope
Files to Fix
src/bin/e2e_tests_full.rs- Main E2E test binarysrc/bin/e2e_provision_and_destroy_tests.rs- Provision/destroy E2E binary- Any helper functions that handle infrastructure cleanup
✅ Acceptance Criteria
Functional Requirements
-
--keepflag ine2e_tests_full.rspreserves infrastructure as intended -
--keepflag ine2e_provision_and_destroy_tests.rspreserves infrastructure as intended -
run_infrastructure_destroyfunction respects thekeepparameter 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-provisionshows VM when preserved, nothing when destroyed
- Run E2E test with
- All E2E tests still pass when
--keepflag is not used (default behavior unchanged)
Testing Requirements
-
Unit tests for CLI argument parsing with
--keepflag -
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
- Parent Epic: EPIC: UI Layer Destroy Command #10 (UI Layer Destroy Command)
- Blocks: Issue 10.3 (Add Clap Subcommand Configuration) - needs manual testing workflow
📚 Related Documentation
Full specification: See docs/issues/fix-e2e-infrastructure-preservation.md