diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index ec535124..78fdf22f 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -119,8 +119,9 @@ These principles should guide all development decisions, code reviews, and featu - **Unit Tests**: When writing unit tests, follow conventions described in [`docs/contributing/testing/`](../docs/contributing/testing/) - **E2E Tests**: - `cargo run --bin e2e-tests-full` - Comprehensive tests (⚠️ **LOCAL ONLY** - cannot run on GitHub Actions due to network connectivity issues) - - `cargo run --bin e2e-provision-tests` - Infrastructure provisioning tests - - `cargo run --bin e2e-config-tests` - Configuration validation tests + - `cargo run --bin e2e-provision-and-destroy-tests` - Infrastructure provisioning and destruction tests (GitHub runner-compatible) + - `cargo run --bin e2e-config-tests` - Software installation and configuration tests (GitHub runner-compatible) + - Pre-commit hook runs the split tests (`e2e-provision-and-destroy-tests` + `e2e-config-tests`) for GitHub Copilot compatibility - See [`docs/e2e-testing.md`](../docs/e2e-testing.md) for detailed information about CI limitations Follow the project conventions and ensure all checks pass. diff --git a/docs/contributing/commit-process.md b/docs/contributing/commit-process.md index 3bf1cd74..181360d8 100644 --- a/docs/contributing/commit-process.md +++ b/docs/contributing/commit-process.md @@ -134,10 +134,29 @@ This script runs all mandatory checks: 2. **Run all linters**: `cargo run --bin linter all` (stable & nightly toolchains) 3. **Run tests**: `cargo test` 4. **Test documentation builds**: `cargo doc --no-deps --bins --examples --workspace --all-features` -5. **Run E2E tests**: `cargo run --bin e2e-tests-full` +5. **Run E2E provision and destroy tests**: `cargo run --bin e2e-provision-and-destroy-tests` +6. **Run E2E configuration tests**: `cargo run --bin e2e-config-tests` +7. **Run code coverage check**: `cargo cov-check` (informational only) **All checks must pass** before committing. Fix any reported issues. +### E2E Test Execution Strategy + +The pre-commit script runs E2E tests as **two separate commands** instead of a single comprehensive test: + +- **Provision and Destroy Tests**: Test infrastructure lifecycle (LXD VMs) +- **Configuration Tests**: Test software installation and configuration (Docker containers) + +This split approach provides the same comprehensive coverage while being compatible with GitHub Actions runners. The split is necessary because GitHub Actions has networking limitations with nested LXD VMs that prevent the full E2E test suite from running. + +**For local development**, you can still run the full E2E test suite manually for convenience: + +```bash +cargo run --bin e2e-tests-full +``` + +This provides the same coverage in a single run but is only supported in local environments with proper LXD networking. + ### Running Individual Linters If you need to run specific linters for debugging: diff --git a/scripts/pre-commit.sh b/scripts/pre-commit.sh index a4d2c73c..331eff78 100755 --- a/scripts/pre-commit.sh +++ b/scripts/pre-commit.sh @@ -20,7 +20,8 @@ declare -a STEPS=( "Running linters|All linters passed|||cargo run --bin linter all" "Running tests|All tests passed|||cargo test" "Testing cargo documentation|Documentation builds successfully|||cargo doc --no-deps --bins --examples --workspace --all-features" - "Running comprehensive E2E tests|All E2E tests passed|(Filtering logs to WARNING level and above - this may take a few minutes)|RUST_LOG=warn|cargo run --bin e2e-tests-full" + "Running E2E provision and destroy tests|Provision and destroy tests passed|(Testing infrastructure lifecycle - this may take a few minutes)|RUST_LOG=warn|cargo run --bin e2e-provision-and-destroy-tests" + "Running E2E configuration tests|Configuration tests passed|(Testing software installation and configuration)|RUST_LOG=warn|cargo run --bin e2e-config-tests" "Running code coverage check|Coverage meets 75% threshold|(Informational only - does not block commits)||cargo cov-check" )