@@ -717,32 +717,51 @@ HTTPS while others use HTTP simultaneously. Instead, we'll take a simpler, more
717717
718718This approach provides comprehensive HTTPS coverage while leveraging existing infrastructure.
719719
720- Implementation Plan :
721-
722- - **Step 1: Add smoke test execution to E2E workflow**
723- - [ ] Add `run_smoke_tests()` method to `E2eTestRunner` in `src/testing/e2e/tasks/black_box/test_runner.rs`
724- - [ ] Execute `cargo run --bin torrust-tracker-deployer -- test <env-name>` via `ProcessRunner`
725- - [ ] The existing `test` command already supports HTTPS via `ServiceEndpoint::https()` with domain resolution
726- - [ ] Call `test_runner.run_smoke_tests()` in `run_deployer_workflow()` after `run_services()`
727- - [ ] Verify E2E tests pass on GitHub Actions (may require runner changes)
728- - [ ] Commit and push to verify CI passes
729-
730- - **Step 2: Enable HTTPS in E2E test configuration**
731- - [ ] Modify `E2eConfigEnvironment::to_json_config()` in `src/testing/e2e/containers/tracker_ports.rs` :
732- - [ ] Add `domain` and `use_tls_proxy : true` for each HTTP tracker
733- - [ ] Add `domain` and `use_tls_proxy : true` for HTTP API
734- - [ ] Add `domain` and `use_tls_proxy : true` for Grafana
735- - [ ] Add `https` section with `admin_email` and `use_staging : true`
736- - [ ] Use `.local` domains (e.g., `api.tracker.local`, `http1.tracker.local`)
737- - [ ] Caddy's internal CA automatically handles `.local` domain certificates
738- - [ ] Wait for Caddy certificate acquisition after `run_services()` (add brief delay or retry logic)
739-
740- - **Step 3: Verify HTTPS E2E tests pass**
741- - [ ] Run E2E tests locally : ` cargo run --bin e2e-deployment-workflow-tests`
742- - [ ] Verify `test` command validates HTTPS endpoints correctly
743- - [ ] Verify Caddy logs show successful certificate acquisition
744- - [ ] Run all linters and pre-commit checks
745- - [ ] Push to GitHub and verify CI passes
720+ **Why the `test` command cannot be used in Docker-based E2E tests** (2026-01-20):
721+
722+ The `e2e_deployment_workflow_tests` binary uses Docker containers (via testcontainers) with
723+ bridge networking, which creates a port mapping layer :
724+
725+ - **Internal ports**: Tracker binds to configured ports (e.g., 1212, 7070) inside the container
726+ - **External ports**: Docker maps these to random host ports (e.g., 1212 → 32942)
727+
728+ The `test` command reads `service_endpoints` from the persisted environment state, which contains
729+ the configured internal ports (e.g., `http://127.0.0.1:1212/api/health_check`). However, to access
730+ services from the host, we need the external mapped ports. This is similar to trying to test
731+ infrastructure behind a VPN - the command only knows about local configuration, not external
732+ network layers.
733+
734+ The existing `run_run_validation()` in Docker-based E2E tests already handles this by using
735+ ` runtime_env.container_ports` which contains the actual Docker-mapped ports.
736+
737+ **Solution: Use LXD VM-based E2E tests** (2026-01-20):
738+
739+ The `e2e_complete_workflow_tests` binary uses LXD virtual machines instead of Docker containers.
740+ In this setup, there's no port mapping layer - the configured ports match the actual ports
741+ accessible from the host. The `test` command works correctly here because :
742+
743+ - The VM has its own IP address (e.g., `10.x.x.x`)
744+ - Services bind to configured ports (1212, 7070, etc.)
745+ - The `test` command can reach services directly at `http://10.x.x.x:1212/api/health_check`
746+
747+ This test binary already calls `validate_deployment()` which runs the `test` command, and it
748+ passes successfully (verified 2026-01-20) :
749+
750+ ` ` ` text
751+ Deployment validated successfully, step: "test", environment: e2e-complete, status: "success"
752+ ` ` `
753+
754+ **Note**: The LXD-based E2E tests cannot run on GitHub Actions CI due to network connectivity
755+ requirements. They must be run manually on a local machine with LXD configured.
756+
757+ **Implementation Status**:
758+
759+ - [x] `test` command already supports HTTPS via `ServiceEndpoint::https()` with domain resolution
760+ - [x] `validate_deployment()` exists in `E2eTestRunner` and calls the `test` command
761+ - [x] LXD VM-based E2E tests (`e2e_complete_workflow_tests`) call `validate_deployment()` after `run_services()`
762+ - [x] Verified LXD VM-based E2E tests pass (2026-01-20)
763+ - [ ] Add HTTPS configuration to LXD VM-based E2E test config (future enhancement)
764+ - [ ] Run LXD VM-based E2E tests with HTTPS configuration to validate end-to-end flow
746765
747766**Configuration Example** (E2E test config):
748767
0 commit comments