From 358576f15f5b5ec96100719ff73b01a996805f6e Mon Sep 17 00:00:00 2001 From: marius Date: Thu, 29 Oct 2026 14:57:52 +0100 Subject: [PATCH] ci(coverage): instrument the PostgreSQL integration tests The seven PostgreSQL integration tests are gated with `#![cfg(not(feature = "test-helpers"))]`, and the workspace coverage run enables `test-helpers` through marreq-server/marreq-cloud, so they compile out of it. CI ran them earlier with plain `cargo test`, which is not instrumented, so the real `repository/diesel_repo` layer read as ~5% covered even though CI exercises it. Run them as instrumented `cargo cov --no-report -p marreq-core --test ...` builds after a single `cargo cov clean --workspace`, and drop the clean from the report step so it no longer wipes what they recorded. `cargo-llvm-cov` merges the profile data in the report. Measured on one tree, against a disposable PostgreSQL: line coverage goes from 79.86% (46780/58575) to 83.25% (48907/58748), and diesel_repo from 4.6% to 38.1%. All seven tests pass. Co-Authored-By: Claude Sonnet 5.5 --- .github/workflows/marreq-ci.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/marreq-ci.yml b/.github/workflows/marreq-ci.yml index 16696d1a..79a14bf4 100644 --- a/.github/workflows/marreq-ci.yml +++ b/.github/workflows/marreq-ci.yml @@ -299,37 +299,45 @@ jobs: - name: Initialize database run: ./marreq-core/scripts/db_setup.sh + # The PostgreSQL integration tests compile out when `test-helpers` is on + # (`#![cfg(not(feature = "test-helpers"))]`), and the workspace run below + # turns it on through marreq-server/marreq-cloud. They therefore have to + # run as their own instrumented `-p marreq-core` builds; `--no-report` + # keeps their profile data so the report merges it with the workspace run. + # Without this the real `repository/diesel_repo` layer reads as 0% covered. + - name: Clean coverage data + run: cargo cov clean --workspace + - name: Run delegated OAuth PostgreSQL integration tests run: | - cargo test -p marreq-core --test delegated_oauth_postgres_integration -- --nocapture + cargo cov --no-report -p marreq-core --test delegated_oauth_postgres_integration -- --nocapture - name: Run project deletion PostgreSQL integration tests run: | - cargo test -p marreq-core --test project_delete_postgres_integration -- --nocapture + cargo cov --no-report -p marreq-core --test project_delete_postgres_integration -- --nocapture - name: Run verification control PostgreSQL integration tests run: | - cargo test -p marreq-core --test verification_control_postgres_integration -- --nocapture + cargo cov --no-report -p marreq-core --test verification_control_postgres_integration -- --nocapture - name: Run use case PostgreSQL integration tests run: | - cargo test -p marreq-core --test use_cases_postgres_integration -- --nocapture + cargo cov --no-report -p marreq-core --test use_cases_postgres_integration -- --nocapture - name: Run requirement update PostgreSQL integration tests run: | - cargo test -p marreq-core --test requirement_update_postgres_integration -- --nocapture + cargo cov --no-report -p marreq-core --test requirement_update_postgres_integration -- --nocapture - name: Run login rate limit PostgreSQL integration tests run: | - cargo test -p marreq-core --test login_rate_limit_postgres_integration -- --nocapture + cargo cov --no-report -p marreq-core --test login_rate_limit_postgres_integration -- --nocapture - name: Run session expiry PostgreSQL integration tests run: | - cargo test -p marreq-core --test session_expiry_postgres_integration -- --nocapture + cargo cov --no-report -p marreq-core --test session_expiry_postgres_integration -- --nocapture - name: Generate coverage reports run: | - cargo cov clean --workspace cargo cov --workspace --no-report cargo cov report --cobertura --output-path coverage.xml cargo cov report --html --output-dir coverage_html