test(db): drive internal/db to 95.7% coverage#139
Closed
mastermanas805 wants to merge 1 commit into
Closed
Conversation
…pers
Covers the platform-DB boot gate: migration apply + idempotency, schema
version tracking via schema_migrations rows + applied_at preservation,
record-failed warn branch (via view-masking the table), connect-helper
panic paths (bad DSN + unreachable host), Err{DB,Redis}Connect Error +
Unwrap, ConnectRedis happy path, and the ticker.C branch of the pool
stats exporter.
Coverage: 35.1% → 95.7% (rule-22 enumeration: 13 functions, 13 touched;
remaining 4.3% is defensive if-err blocks on embed.FS reads which
provably never fail on a compiled-in directory).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
4 tasks
Member
Author
|
Superseded by #146 (merged), which includes the rebased |
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
api/internal/dbcoverage from 35.1% to 95.7%.RunMigrationsx2 preservesapplied_at), schema version tracking (schema_migrationsrow count =MigrationFileslength), record-failed warn branch (view-masking the tracking table proves the loop doesn't error when the per-filename INSERT fails), connect-helper panic paths (bad DSN + unreachable Postgres/Redis),Err{DB,Redis}Connect.{Error,Unwrap}, env-tunable pool knobs, and theticker.Cbranch ofStartPoolStatsExporter.Test plan
TEST_DATABASE_URL=... go test ./internal/db -coverprofile=cov.out -count=1→ 95.7%go vet ./internal/dbcleango build ./...cleanif err != nilonembed.FSreads which provably never fail on a compiled-in directory + lib/pqsql.Openwhich never returns an error.Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com