test(coverage): drive providers/compute to ≥95% (k8s 17% → 95.9%)#147
Merged
Conversation
Cover the k8s compute client end-to-end with fake clientsets (no real cluster): build-job manifest assembly, deployment/service/ingress/NetworkPolicy create+delete, status polling (running/failed/pending), namespace create+teardown, cert-manager TLS wiring, and every apierrors error branch (IsNotFound / IsAlreadyExists). Adds buildImage error-path coverage, MinIO build-context upload happy + create-bucket paths via an in-process S3 stub, extractTarGz filesystem-error branches, and the isUnderDir traversal guards. noop + compute root packages reach 100%. newDynamicClient becomes a package-level var so tests can inject a fake dynamic client for cert-manager Certificate readiness checks. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
internal/providers/compute/k8sfrom ~17% to 95.9% statement coverage;computeroot andnoopreach 100%.k8s.io/client-go/kubernetes/fake+ a fake dynamic client — no real cluster, no docker DB.extractTarGzfilesystem-error branches, and everyapierrors.IsNotFound/IsAlreadyExistserror branch.newDynamicClientconverted to a package-level var so tests can inject a fake dynamic client for Certificate readiness; production fallback chain unchanged.Test plan
go build ./...cleango vet ./internal/providers/compute/...cleango test ./internal/providers/compute/... -coverprofile -count=1 -p 1→ k8s 95.9%, compute 100%, noop 100%🤖 Generated with Claude Code