test(coverage): drive resource-provisioning handlers 45% -> 75%#145
Merged
Conversation
Adds black-box + white-box tests for the resource-provisioning handler files (resource.go, resource_metrics.go, resource_family.go, db.go, cache.go, nosql.go, queue.go, storage.go, webhook.go): - coverage_resource_extra_test.go: MinIO-backed credential-mode storage provisioning (anon + authed + quota + dedup), full resource_metrics.go tier-gate matrix (92.5%), postgres rotate. - coverage_resource_backend_test.go: full-backend lifecycle flows (provision -> getcredentials -> rotate -> pause -> resume -> delete) for postgres/redis/mongo against the local Docker backends, twin paths, and per-handler negative paths (bad body / missing name / bad env / 415). - coverage_resource_unit_test.go: package-internal helpers (decryptConnectionURL fail-closed, decryptWebhookURL fail-open, storeEncryptedURL, addQueueCredentials, metrics tier-cap helpers, anonymous-limits builders). - coverage_resource_pure_test.go / coverage_resource_files_test.go: resumed partial work (pure helpers, authed provision, presign, delete, pause/resume, dedup branches). - Renamed existing twin / metrics / body-validation tests to match the resource test-name prefixes so they run under the coverage gate filter. Target was >=95%; the residual gap is the gRPC provisioner-client arms (provisionDB/Cache/NoSQL/Queue) and DB/encrypt fault-injection branches, which the handlers' public constructors expose no seam to exercise. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
TestQueueNew_Authenticated_Pro (resumed partial work) asserted 201 unconditionally; CI has no NATS backend so /queue/new returns 503. Add the skipIfProvisionResp guard used by the sibling provision tests so the suite skips rather than fails when the queue backend is unreachable. 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
resource.go,resource_metrics.go,resource_family.go,db.go,cache.go,nosql.go,queue.go,storage.go,webhook.go), raising aggregate statement coverage on these files from 45.1% to 74.6%.coverage_resource_extra_test.go(MinIO-backed storage provisioning + full metrics tier matrix),coverage_resource_backend_test.go(full-backend pause/resume/rotate/twin/negative-path flows),coverage_resource_unit_test.go(package-internal decrypt/credentials/metrics helpers), plus resumed partial work incoverage_resource_pure_test.go/coverage_resource_files_test.go.-runfilter.Per-file coverage (after)
Note on the 95% target
The task target was >=95%. The residual uncovered code is dominated by (a) the gRPC provisioner-client arms (
provisionDB/Cache/NoSQL/Queue, theprovClient != nilbranch) and (b) DB / encrypt fault-injection error branches. The handlers take a concrete*provisioner.Clientwith unexported fields and no DI seam, so these paths are not reachable fromhandlers_testwithout a bufconn gRPC server / handler refactor — out of scope for a test-only change.Test plan
go build ./...+go vet ./...cleango test ./internal/handlerssuite passes (no regressions from renames)-runfilter suite green with backends (pg/redis/mongo/minio) up; skips cleanly when a backend is absent🤖 Generated with Claude Code