Skip to content

ci: collect e2e coverage from the KinD test job #2209

Closed

Description

@TerryHowe

Context

#2208 removes the Docker-on-the-runner e2e path (make teste2e / make teste2e-covdata), leaving e2e-k8s as the only e2e entry point. That job collects no coverage today, which is why #2208 has to lower the codecov project target to stay green.

Measured on 715917d (origin/main):

  • codecov reports 88.14% for the repo today. The build job logs Found 2 coverage files to report — coverage.txt and test/e2e/coverage.txt.
  • Unit tests alone give 61.1% statement coverage, or 60.7% excluding codecov's ignored internal/testutils (go test -coverprofile -covermode=atomic -coverpkg=./... ./...).

So the e2e suite contributes roughly 27 points, against a hard project target of 75% in .github/.codecov.yml.

Why the KinD job produces nothing today

Coverage was never a property of the Docker path itself. test/e2e/internal/utils/init.go, in BeforeSuite, keys off GOCOVERDIR — when it is set, it discards the prebuilt ORAS_PATH binary and rebuilds an instrumented one:

buildArgs = append(buildArgs, "-coverpkg", "oras.land/oras/cmd/oras/...,oras.land/oras/internal/...")
ORASPath, err = gexec.Build("oras.land/oras/cmd/oras", buildArgs...)

test/e2e/k8s/e2e-test-job.yaml sets ORAS_PATH=/workspace/bin/linux/amd64/oras and never sets GOCOVERDIR, and make build-linux-amd64 builds without -cover. There is no GOCOVERDIR anywhere under test/e2e/k8s/, test/e2e/Dockerfile, test/e2e/scripts/, or .github/workflows/e2e-k8s.yml.

Proposed work

  1. Set GOCOVERDIR in test/e2e/k8s/e2e-test-job.yaml. No test-code change is needed — init.go self-instruments. The image already carries Go, gcc, musl-dev and a populated module cache, so the in-pod rebuild works. This is proven under ginkgo -p: old build logs show coverage instrumenting is enabled once per parallel process.
  2. Point GOCOVERDIR at a hostPath volume so the data outlives the pod. The job already uses that pattern for zot-data → /tmp/oras-e2e-zot-data.
  3. Extract it. kubectl cp will not work here — it needs exec into a running container, and the job pod has terminated by the time the workflow would copy. Either docker cp kind-control-plane:<path> on the runner, or reuse the debug-pod-mounting-the-same-hostPath approach already in test/e2e/scripts/generate-cache-db.sh.
  4. Convert with go tool covdata textfmt -i=<dir> -o test/e2e/coverage.txt, either inside the pod or on the runner (setup-go has already run by then).

Acceptance

Publish test/e2e/coverage.txt as a workflow artifact and confirm go tool cover -func on it reports non-zero cmd/oras/... coverage. The suite contains no Skip(), XIt or Pending specs and e2e-k8s runs the same ginkgo -r -p suite, so the combined total should return to roughly 88% rather than landing somewhere in between.

Notes

  • The job caps at 4Gi / 2000m. One instrumented go build per parallel ginkgo process, on top of --race, may require raising those.
  • Uploading to codecov and restoring the 75% target are deliberately out of scope here and tracked separately.

Activity

  1. added
    E2E testing
    on Oct 2, 2026
  2. TerryHowe commented on Oct 2, 2026

    @TerryHowe
    MemberAuthor

    The codecov upload and the restore of the 75% project target are tracked in #2213, which is blocked on this issue.

  3. sinbumu commented on Nov 17, 2026

    @sinbumu
    Contributor

    I'd like to work on this. I plan to enable GOCOVERDIR for the KinD test Job, retain per-run data on the node, and extract/convert it after the Job exits so e2e-k8s can publish test/e2e/coverage.txt. I'll also check the parallel/race run's resource usage. Codecov upload and the target change will remain in #2213. I'll use AI assistance for implementation and validation and disclose the checks performed in the PR.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    E2E testingci

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions