Skip to content

ci: collect coverage from KinD e2e tests - #2340

Merged
TerryHowe merged 2 commits into
oras-project:mainfrom
sinbumu:ci/kind-e2e-coverage-2209
Nov 18, 2026
Merged

TerryHowe merged 2 commits into
oras-project:mainfrom
sinbumu:ci/kind-e2e-coverage-2209

Conversation

@sinbumu

@sinbumu sinbumu commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The KinD e2e Job currently runs without GOCOVERDIR, so it never instruments ORAS or produces an e2e coverage artifact.

This enables coverage in a Pod-UID-specific hostPath directory, then collects it after the test Pod terminates. The collector resolves the actual KinD node from the Pod and streams a tar archive from that running node: kubectl cp cannot read a terminated test container, and docker cp cannot read KinD's /tmp tmpfs. It converts the data with go tool covdata textfmt, checks for non-zero cmd/oras/... coverage, and writes test/e2e/coverage.txt.

The workflow uploads that file, including partial coverage from failed tests when collection succeeds, while preserving the test failure. Two Ginkgo workers and GOMAXPROCS=2 bound build concurrency within the existing 2 CPU / 4Gi limits. The README documents collection and storage lifetime. Codecov upload and the project target remain scoped to #2213.

Validation:

  • Isolated, custom-named KinD cluster on Linux/arm64: all 3 race-enabled suites passed (660 specs, 2 parallel workers). Extracted coverage after Pod termination: 72.3%, with 482 non-zero cmd/oras/... functions. Observed memory peak was about 1.1GiB, with no OOM events.
  • An intentional exit-42 Job produced a separate partial report; earlier full-suite data was not included.
  • Local collector regression harness using real Go coverage data and mocked Kubernetes/Docker boundaries: success, failed Pod, running Pod rejection, missing/empty data, metadata without counters, corrupt data, and current-Pod isolation checked.
  • go test -race ./..., go vet ./..., ShellCheck, bash -n, actionlint, Kubernetes server dry-run, and git diff --check passed.

The first local e2e attempt could not download modules from inside the Pod. The successful run used a local-only image layer that prefetched the unchanged e2e dependencies; the repository Dockerfile is unchanged. The CI artifact upload still needs the upstream workflow run.

AI assistance was used to implement and validate this change.

Which issue(s) this PR fixes:
Fixes #2209

Please check the following list:

  • Does the affected code have corresponding tests, e.g. unit test, E2E test? Full KinD e2e run and collector checks above.
  • Does this change require a documentation update? Collection instructions added.
  • Does this introduce breaking changes that would require an announcement or bumping the major version? No.
  • Do all new files have an appropriate license header?

Enable per-Pod coverage storage and collect it from the running KinD node
once the test Pod terminates. Publish the converted profile as a workflow
artifact and reject reports without non-zero CLI coverage.

Bound parallel instrumented builds to the Job's CPU budget and document
local collection. Keep Codecov integration separate.

Fixes oras-project#2209

Signed-off-by: sinbumu <[email protected]>
Comment thread test/e2e/README.md Resolved
Comment thread test/e2e/k8s/e2e-test-job.yaml Resolved

@TerryHowe TerryHowe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

/lgtm

@TerryHowe
TerryHowe marked this pull request as ready for review November 18, 2026 12:06
@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.89%. Comparing base (61097e9) to head (825c18b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2340   +/-   ##
=======================================
  Coverage   74.89%   74.89%           
=======================================
  Files         157      157           
  Lines        6584     6584           
=======================================
  Hits         4931     4931           
  Misses       1364     1364           
  Partials      289      289           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@TerryHowe
TerryHowe merged commit f2e8276 into oras-project:main Nov 18, 2026
10 checks passed
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.

ci: collect e2e coverage from the KinD test job

2 participants