test(coverage): drive server/handlers to ≥95% - #20
Merged
Conversation
- server: 54.8% → 98.9%. Adds dedicated-backend dispatch tests for every RPC (Provision/Deprovision/StorageBytes/Regrade) across postgres, redis, mongo, and queue; pool-hit / pool-error / pool-miss branches via a new PoolClaimer interface seam; callBackendVoid breaker-open path; end-to-end gRPC round-trip via bufconn; New() constructor branches for k8s + MinIO + dedicated DSN configs; teamIDFromContext via metadata; PostgresBackend / Breakers accessors. - handlers: 94.1% → 100%. Adds long-error-message truncation path on platformDBCheck and a whitebox test for the defensive nil-pool branch. - Minor refactor in server.go: typed *pool.Manager field becomes a PoolClaimer interface so tests can inject a fake claimer without standing up a real *pgxpool.Pool. Production behaviour preserved by normalising nil *pool.Manager to a nil interface in NewWithBackends. Joint coverage now well above the 95% gate on both packages. 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
What changed
server_coverage_test.gowith dedicated-backend dispatch tests for every gRPC RPC (Provision/Deprovision/StorageBytes/Regrade) across postgres, redis, mongo, and queue.PoolClaimerinterface seam (one-method,*pool.Managerstill satisfies it) and a test-onlySetPoolso the pool-hit / pool-error / pool-miss branches inprovisionPostgres/Redis/Mongo/Queueare exercisable without a real*pgxpool.Pool. Nil-pointer normalisation preserves production behaviour.bufconnfor Provision/Deprovision/StorageBytes plus the empty-token guard.callBackendVoidbreaker-open,New()k8s + MinIO + dedicated-DSN constructors,teamIDFromContextvia metadata,PostgresBackend/Breakersaccessors,mapErrorinvalid-arg path, pool-token-marker stripping inregradeRedis.platformDBCheckand a whitebox test for the defensiveh.pool == nilbranch.Test plan
make gategreen locallygo test ./internal/server ./internal/handlers -coverprofile=…reports ≥95% on eachgo test ./...green across all packages*pool.Manager→PoolClaimerswitch normalises nil pointers to nil interfaces inNewWithBackends🤖 Generated with Claude Code