test(coverage): provisioner CI service-containers unlock + internal/config ≥95%#29
Merged
Merged
Conversation
… 95%+
Two coverage unlocks for the provisioner full suite:
1. coverage.yml service containers. The job ran `go test ./... -short` with
no DB services, so every env-gated integration test in internal/pool and
internal/backend/{postgres,redis,mongo} skipped silently — pool sat at 47%
while the suite still reported green. Added postgres:16-alpine,
redis:7-alpine, mongo:6 (no-auth + a second auth instance on :27018), and
nats:latest -js service containers with health checks, plus the exact
TEST_* env var names the test helpers read (grepped from os.Getenv call
sites, not guessed). Dropped `-short` (the gate is env reachability, not
testing.Short() — there are zero testing.Short() call sites) and added
`-p 1` so the DB-touching packages don't oversubscribe the shared
containers.
2. internal/config tests. Was 0%; config_test.go now covers getenv, getenvInt
(valid/empty/non-numeric/negative arms), Load default + override arms for
every field, the K8S_DEDICATED_BACKEND exact-"true" boolean, and
logStartupConfig — 100%.
Local verification (containers on 127.0.0.1, full suite -p 1):
pool 47.1% -> 96.4%
postgres 99.5% -> 99.6%
redis 84.5% -> 95.3%
mongo 90.8% -> 96.2%
config 0.0% -> 100.0%
full-suite total 91.6% -> 97.6%
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The nats:latest service container failed to initialize in CI (its healthcheck used wget, absent from the minimal image, and GHA services can't pass -js to enable JetStream). No TEST_* env var references it and the queue-backend package coverage is unchanged (96.8%), so the queue tests never connected to it — it was dead weight breaking the job. 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
Closes the provisioner coverage gap by (1) wiring CI service containers so the existing env-gated integration tests actually run, and (2) testing the previously-untested
internal/configpackage.1. CI service-containers unlock (highest leverage)
coverage.ymlrango test ./... -shortwith no DB service containers. Every integration test ininternal/poolandinternal/backend/{postgres,redis,mongo}is gated onos.Getenv("TEST_…")reachability and was therefore skipping silently —internal/poolsat at 47.1% while the suite still reported green.Changes:
services:forpostgres:16-alpine,redis:7-alpine,mongo:6(no-auth) + a second authenticatedmongo:6on host port27018(for theCUSTOMER_MONGO_AUTH_URLauth-fail branches), andnats:latest -js. Each has a health-check.TEST_*env vars the helpers read — names grepped from theos.Getenvcall sites andliveXxx()fallbacks, not guessed:TEST_PROVISIONER_DATABASE_URL,TEST_POSTGRES_ADMIN_DSN/CUSTOMER_POSTGRES_DSN/TEST_POSTGRES_CUSTOMERS_URL,TEST_REDIS_ADDR,CUSTOMER_REDIS_URL,REDIS_URL_TEST,CUSTOMER_MONGO_URL,CUSTOMER_MONGO_AUTH_URL.-short: there are zerotesting.Short()call sites ininternal/— the gate is purely env-var reachability. Added-p 1so the many DB-touching packages don't open connections concurrently against the shared service containers.StorageByteshits the Service ClusterIP on:6379;liveRedisAddrfalls back tolocalhost:6379).2.
internal/config0% → 100%New
internal/config/config_test.gocoversgetenv,getenvInt(valid / empty / non-numeric / negative arms),Loaddefault and override arm for every field, theK8S_DEDICATED_BACKENDexact-"true"boolean semantics, andlogStartupConfig. Usest.Setenvfor all permutations.Coverage block (full-suite
go test ./... -p 1 -coverprofile -covermode=atomic)internal/poolinternal/configinternal/backend/postgresinternal/backend/redisinternal/backend/mongointernal/backend/queueAll packages pass; full-suite total 97.6% clears the 95% floor with no waivers — purely test seams (env-gated integration tests now executed + new unit tests).
Verification
postgres:16-alpine/redis:7-alpine/mongo:6(+ auth mongo) /nats:latestcontainers bound to127.0.0.1, env exported,go test ./... -p 1 -coverprofile.go build ./...+go vet ./...clean.🤖 Generated with Claude Code