-
Notifications
You must be signed in to change notification settings - Fork 0
refactor: [#200] use black-box CLI execution in E2E full tests #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Remove TestContext and direct command_handlers imports - Use ProcessRunner for all CLI commands (create, provision, configure, test, destroy) - Add run_configure_command and run_test_command to ProcessRunner - Generate dynamic environment config with absolute SSH key paths - Apply same pattern from issue #199 to full E2E lifecycle tests
- Move src/testing/black_box/ to src/testing/e2e/black_box/ - Update module declarations and re-exports - Update import paths in binaries and tests - black_box contains E2E testing utilities (ProcessRunner)
- Create src/testing/e2e/black_box/tasks/ module - Add verify_dependencies.rs with shared function - Function accepts dependencies slice as parameter - Remove duplicate implementations from both E2E binaries
- Move process_runner.rs to src/testing/e2e/ (remove black_box wrapper) - Move tasks/verify_dependencies.rs to src/testing/e2e/tasks/black_box/ - Remove empty black_box directory - Update all imports and re-exports
- Create preflight_cleanup.rs in src/testing/e2e/tasks/black_box/ - Function removes artifacts from previous test runs - Remove duplicate implementations from both E2E binaries
- Create generate_config.rs in src/testing/e2e/tasks/black_box/ - Function generates environment config with absolute SSH key paths - Remove duplicate implementations from both E2E binaries
Extract the duplicate create_environment function from both E2E binaries into a shared task module at src/testing/e2e/tasks/black_box/create_environment.rs. This reduces code duplication and keeps the shared E2E task functions centralized for easier maintenance.
Extract the duplicate provision_infrastructure function from both E2E binaries into a shared task module at src/testing/e2e/tasks/black_box/provision_infrastructure.rs. This reduces code duplication and keeps the shared E2E task functions centralized for easier maintenance.
Extract the duplicate destroy_infrastructure function from both E2E binaries into a shared task module at src/testing/e2e/tasks/black_box/destroy_infrastructure.rs. This reduces code duplication and keeps the shared E2E task functions centralized for easier maintenance.
Extract the validate_deployment function from e2e_tests_full.rs into a shared task module at src/testing/e2e/tasks/black_box/validate_deployment.rs. This follows the same pattern as the other extracted functions and keeps the shared E2E task functions centralized for easier maintenance and potential reuse.
Extract the configure_services function from e2e_tests_full.rs into a shared task module at src/testing/e2e/tasks/black_box/configure_services.rs. This follows the same pattern as the other extracted functions and keeps the shared E2E task functions centralized for easier maintenance and potential reuse.
Extract the repeated (runner, environment_name) pattern into a cohesive
E2eTestRunner type that encapsulates:
- The ProcessRunner for CLI command execution
- The environment name for the test session
- A cleanup_on_failure flag to control automatic cleanup
This eliminates the data clump code smell where runner and environment_name
were passed together to 5 different task functions.
Changes:
- Add E2eTestRunner struct with methods for all test tasks
- Add with_cleanup_on_failure() builder method for configuration
- Convert task functions to methods: create_environment, provision_infrastructure,
configure_services, validate_deployment, destroy_infrastructure
- Remove individual task modules that are now methods
- Update both E2E test binaries to use the new abstraction
The workflow now reads more naturally:
let test_runner = E2eTestRunner::new("e2e-full")
.with_cleanup_on_failure(true);
test_runner.create_environment(&config_path)?;
test_runner.provision_infrastructure()?;
test_runner.configure_services()?;
test_runner.validate_deployment()?;
test_runner.destroy_infrastructure()?;
Member
Author
|
ACK 0e3ab51 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Refactors
e2e_tests_full.rsto use black-box CLI execution viaProcessRunner, following the same pattern established in issue #199.Changes
TestContextand directcommand_handlersimportsProcessRunnerrun_configure_commandandrun_test_commandmethodsTesting
Related