Repository navigation
Description
Rename and Update E2E Provision Tests to Include Destroy
Issue Type: Sub-issue (9.2)
Parent Epic: #9 (epic-app-layer-destroy-command.md)
Related Roadmap: Section 1.2
Dependencies: Issue #11 (Add DestroyCommand in Application Layer) must be completed first
Priority: High
Estimated Effort: 3-4 hours
📋 Issue Overview
Modify and rename src/bin/e2e_provision_tests.rs to src/bin/e2e_provision_and_destroy_tests.rs, updating it to use the new destroy command instead of manual cleanup, ensuring CI can run complete provision+destroy cycles.
This ensures we have automated testing of the destroy functionality in CI, preventing regressions. The provision tests are already running real OpenTofu infrastructure, so adding destroy testing here gives us confidence the feature works end-to-end.
🎯 Goals
- Replace manual cleanup with
DestroyCommandin E2E provision tests - Maintain fallback to manual cleanup for destroy command failures
- Ensure compatibility with GitHub Actions CI environment
- Provide comprehensive E2E testing of the full provision+destroy lifecycle
📦 Scope
Core Changes
- Rename
e2e_provision_tests.rstoe2e_provision_and_destroy_tests.rs - Replace manual cleanup with
DestroyCommand - Keep manual cleanup as fallback for destroy command failures
- Ensure the binary works in GitHub Actions environment
Integration Points
- DestroyCommand Integration: Use the new application layer command
- Error Handling: Graceful fallback to manual cleanup on destroy failures
- CI Compatibility: Ensure tests work in GitHub Actions
- Logging: Proper error handling and logging for destroy operations
🏗️ Technical Design
Test Flow Integration
Current flow:
Provision → Manual Cleanup
New flow:
Provision → DestroyCommand → (Fallback: Manual Cleanup on failure)
Error Handling Strategy
// Pseudo-code for destroy integration
match destroy_command.execute(&environment).await {
Ok(_) => {
info!("Environment destroyed successfully using DestroyCommand");
}
Err(e) => {
warn!("DestroyCommand failed: {e}, falling back to manual cleanup");
manual_cleanup(&environment).await?;
}
}Binary Renaming
Rename e2e_provision_tests.rs to e2e_provision_and_destroy_tests.rs to reflect the expanded functionality:
- More descriptive of actual test coverage
- Clearly indicates full lifecycle testing
- Aligns with the enhanced scope
- Better represents the complete provision+destroy workflow
📋 Acceptance Criteria
- Binary renamed from
e2e_provision_tests.rstoe2e_provision_and_destroy_tests.rs - Binary uses
DestroyCommandfor cleanup instead of manual cleanup - Manual cleanup preserved as fallback for destroy failures
- Binary works correctly in GitHub Actions
- Proper error handling and logging for destroy operations
- CI configuration updated with new binary name
- E2E test documentation updated with new binary name and functionality
🧪 Testing Strategy
Local Testing
- Run the updated binary locally to verify destroy command integration
- Test both success and failure scenarios
- Validate fallback to manual cleanup works correctly
CI Testing
- Ensure the updated binary works in GitHub Actions
- Verify no regressions in existing provision test functionality
- Confirm destroy command is properly tested in CI environment
Error Scenarios
- Test destroy command failures and fallback behavior
- Validate proper logging and error reporting
- Ensure manual cleanup still works as expected
🔗 Dependencies
- Requires: Issue Add DestroyCommand in Application Layer #11 (Add DestroyCommand in Application Layer) - must be completed first
- Requires: Existing E2E provision test infrastructure
- Blocks: Issue 9.3 (Developer Documentation)
📝 Implementation Notes
Current E2E Provision Test Structure
The current src/bin/e2e_provision_tests.rs binary:
- Provisions infrastructure using OpenTofu
- Validates deployment
- Performs manual cleanup using existing cleanup functions
After this issue, the renamed src/bin/e2e_provision_and_destroy_tests.rs binary will:
- Provision infrastructure using OpenTofu
- Validate deployment
- Destroy infrastructure using
DestroyCommand(with manual cleanup fallback)
Integration Approach
- Rename Binary: Move
e2e_provision_tests.rstoe2e_provision_and_destroy_tests.rs - Import DestroyCommand: Add the new command from the application layer
- Replace Cleanup Logic: Use
DestroyCommandinstead of manual cleanup functions - Add Fallback: Preserve manual cleanup as backup for destroy failures
- Update Logging: Enhance logging to show destroy command usage
- Test Integration: Validate the integration works in both local and CI environments
CI Configuration Updates
Required updates for the binary rename:
- Update
.github/workflows/references frome2e_provision_teststoe2e_provision_and_destroy_tests - Update documentation references to the new binary name
- Update any scripts that call the binary
- Update
Cargo.tomlbinary configuration if needed
🚀 Next Steps
After completing this issue:
- Validate E2E tests work in both local and CI environments
- Document the updated E2E testing approach in Issue 9.3
- Consider expanding destroy testing to other E2E test binaries
📊 Related Documentation
Issue Document: docs/issues/epic-app-layer-destroy-command-update-e2e-provision-tests.md
Activity
feat: [#9] create sub-issues for Epic App Layer Destroy Command
docs: add GitHub issue links to all issue documents
Merge #20: docs: add user documentation for Destroy Command