test(postgres): raise backend/postgres coverage to 91.6%#22
Merged
Conversation
Add live + fake-clientset tests across the postgres provisioning backend: LocalBackend Provision/StorageBytes/Deprovision/Regrade (happy + connect / CREATE USER / privilege-denied error branches), DedicatedProvider local + Neon paths, K8sBackend orchestration (per-step rollback, applyNamespace terminating-recreate, waitPodReady error/cancel, StorageBytes/Regrade deep paths via a fake Service pointed at a real Postgres), NeonBackend httptest success/error paths, and the NewBackend k8s route-registry factory branch. Remaining uncovered statements are defensive handlers not reachable without mocking pgx/http/clientset (conn.Close error logs, crypto/rand failures, http request-construction wraps, the k8s real-pod-only route-registry block, and 3-minute pod-ready timeouts). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
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/backend/postgresstatement coverage from a 18.7% baseline to 91.6%.What's covered
applyNamespaceterminating-recreate + ctx-cancel,waitPodReadylist-error + ctx-cancel, andinitDatabase/StorageBytes/Regradedeep paths driven against a real Postgres by pointing a fake Service's ClusterIP at127.0.0.1and seeding the admin Secret.REDIS_URL_FOR_ROUTES).Remaining gap (8.4%)
Uncovered statements are defensive handlers not reachable without adding test seams to production code:
conn.Closeerror logs,crypto/randfailures,http.NewRequest/json.Marshalconstruction wraps, the k8s real-pod-only route-registry block, and 3-minute pod-ready timeouts.Test plan
CUSTOMER_POSTGRES_DSN=… go test ./internal/backend/postgres -count=1— all pass, 91.6% coverage, ~21sgo vet ./internal/backend/postgrescleangofmt -lclean on all test files🤖 Generated with Claude Code