Skip to content

test(db): drive internal/db to 95.7% coverage#139

Closed
mastermanas805 wants to merge 1 commit into
masterfrom
coverage/api-db-95
Closed

test(db): drive internal/db to 95.7% coverage#139
mastermanas805 wants to merge 1 commit into
masterfrom
coverage/api-db-95

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

Summary

  • Drives api/internal/db coverage from 35.1% to 95.7%.
  • Tests: migration apply + idempotency (RunMigrations x2 preserves applied_at), schema version tracking (schema_migrations row count = MigrationFiles length), 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 the ticker.C branch of StartPoolStatsExporter.

Test plan

  • TEST_DATABASE_URL=... go test ./internal/db -coverprofile=cov.out -count=1 → 95.7%
  • go vet ./internal/db clean
  • go build ./... clean
  • Remaining 4.3% is defensive if err != nil on embed.FS reads which provably never fail on a compiled-in directory + lib/pq sql.Open which never returns an error.

Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com

…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>
@mastermanas805
Copy link
Copy Markdown
Member Author

Superseded by #146 (merged), which includes the rebased internal/db work plus the remaining api straggler packages. Closing.

@mastermanas805 mastermanas805 deleted the coverage/api-db-95 branch May 22, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant