Skip to content

ci(coverage-ut): run embedded-cluster packages in their own pass - #484

Merged
fengttt merged 1 commit into
mainfrom
coverage-ut-embedded-pass
Nov 24, 2026
Merged

fengttt merged 1 commit into
mainfrom
coverage-ut-embedded-pass

Conversation

@fengttt

@fengttt fengttt commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Coverage UT keeps failing on embedded-cluster tests that pass in the race UT (matrixorigin/matrixone#33077). Recent examples: #33115 and #32523. A trivial statement such as use mo_catalog or a cleanup DROP DATABASE is rejected with

execution resource admission rejected: requested=48 used=0 cap=0;
physical memory headroom: sampled_available=1014726656 safety_reserve=1073741824 growth_headroom=0

Why only coverage: coverage UT runs all ~500 packages in one go test -p 8 on a 15 GiB runner. Embedded MO clusters overlap with heavy packages (plan, disttae, vm/engine/test) and with the linking of other ~300 MB coverage binaries. A cluster's CN admits execution memory against the runner's free memory minus a 1 GiB reserve, and under that overlap it briefly has none. The race UT (optools/run_ut.sh) runs embedded-cluster packages in their own stage and does not hit this.

Change: scripts/run_coverage_ut_phases.sh runs coverage UT as two sequential go test passes with the same flags and -coverpkg:

  1. Every other package, with COVERAGE_UT_PACKAGE_PARALLELISM (8, unchanged).
  2. The embedded-cluster packages on their own, with COVERAGE_UT_EMBEDDED_PACKAGE_PARALLELISM (2) and MO_TEST_CLUSTER_ADMISSION_POOL_SIZE set to match.
  • The embedded packages come from matrixone's list_embedded_cluster_test_packages (optools/ut_tools.bash), the dependency-graph rule run_ut.sh already uses (currently 11 packages). If the checkout predates that helper or the lookup fails, the run falls back to today's single pass, and classify_embedded in the phase timing shows the status.
  • The two profiles are joined before the existing compaction step, so the uploaded profile has the same shape as before.
  • The JSON report stays pure go test -json. A pass warns in plain text for each -coverpkg package it does not import; that one warning is filtered, and all other stderr passes through.
  • If the first pass fails, the embedded pass still runs, and the step fails with the first pass's status. If the first pass is stopped by a signal, the embedded pass does not start.
  • The phase timing records each pass (coverage_ut_ordinary, coverage_ut_embedded) with its package count and elapsed time.

Cost: the embedded packages took 2,945 s of package time in the failing run, much of it waiting for each other's cluster admission lock under -p 8. Run alone with -cover, the three largest took 5.4, 3.5 and 2.4 minutes locally. I expect the pass to add a few minutes to a ~25-minute step that has a 60-minute deadline. The first runs on this branch will give the real number.

Testing:

  • scripts/test_run_coverage_ut_phases.py (added to Check Yaml) drives the script with a fake go. It covers the split, per-pass parallelism and pool, profile joining, a pure-JSON stdout, warning filtering, failure and signal statuses, and the empty-embedded single pass.
  • End to end against the matrixone tree with real go: the helper classifies, both passes run, the report has 0 non-JSON lines, and compact_coverage_profile accepts the joined profile.
  • actionlint 1.7.12 is clean.

Companion: matrixorigin/matrixone#33142 makes embedded test clusters measure memory against a per-process limit instead of the runner's free memory. Either change alone removes most of these failures; together they also cover packages added to the embedded set later.

🤖 Generated with Claude Code

Coverage UT ran all ~500 packages in one `go test -p 8`, so embedded MO
clusters overlapped with heavy packages and with the linking of other
coverage binaries. A cluster's CN admits execution memory against the
runner's free memory minus a 1 GiB reserve, and under that overlap it
rejected even trivial statements (matrixorigin/matrixone#33077). The race
UT (optools/run_ut.sh) already isolates these packages and does not hit
this.

scripts/run_coverage_ut_phases.sh now runs two sequential passes: every
other package with the existing parallelism, then the embedded-cluster
packages alone with COVERAGE_UT_EMBEDDED_PACKAGE_PARALLELISM (2) and a
matching cluster admission pool. The packages come from matrixone's own
list_embedded_cluster_test_packages (optools/ut_tools.bash), the rule
run_ut.sh uses; if the checkout lacks it or the lookup fails, the run
falls back to the single pass. The two profiles are joined before the
existing compaction step, and the report stays pure go test JSON.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fengttt
fengttt requested a balanced review from Copilot November 24, 2026 06:44
@fengttt
fengttt enabled auto-merge (squash) November 24, 2026 06:45
@fengttt
fengttt disabled auto-merge November 24, 2026 06:46
@fengttt
fengttt enabled auto-merge (squash) November 24, 2026 06:46
@fengttt
fengttt disabled auto-merge November 24, 2026 06:46
@fengttt
fengttt merged commit a5b8803 into main Nov 24, 2026
1 of 2 checks passed
@fengttt
fengttt deleted the coverage-ut-embedded-pass branch November 24, 2026 06:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the change separating embedded-cluster coverage tests to reduce CI memory contention.

No open issues 🎉

What changed in this PR

This PR separates embedded-cluster coverage tests from other packages to reduce memory contention in coverage CI, following the staging approach used by race UT.

Changes:

  • Classifies embedded-cluster packages and runs them in a separate, lower-parallelism pass, with a single-pass fallback if classification is unavailable or fails.
  • Joins coverage profiles, preserves JSON output, and records per-pass timing and status.
  • Adds contract tests and runs them in the Check Yaml workflow.
File Description
scripts/​test_run_coverage_ut_phases.py Tests package splitting, output handling, profile joining, and exit statuses.
scripts/​run_coverage_ut_phases.sh Implements sequential coverage passes and profile joining.
.github/​workflows/​coverage-ut.yaml Integrates package classification and the phased coverage runner.
.github/​workflows/​check-action-file.yaml Adds triggers and execution for the new contract tests.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants