test(coverage): drive pool/circuit/telemetry/ctxkeys/root to ≥95%#27
Merged
Merged
Conversation
Brings the provisioner's hot-pool manager, per-backend circuit breakers, OTel tracer init, ctxkeys, and the root package (main Run seam) to ≥95% statement coverage: - internal/pool 26.3% -> 96.4% (DB-integration tests for migrate/ Start/Claim/Stats/fillPool/provisionOneItem lifecycle + failing-backend and closed-pool error arms; tickInterval seam to exercise the periodic refill without a 30s wait) - internal/circuit 94.9% -> 100.0% (constructor clamps, isCallerDeadline nil arm, half-open-reopen onOpen callback) - internal/telemetry 80.4% -> 98.3% (plaintext/TLS + NR-license-header arms; newExporter/newResource seams force the construction-error arms) - internal/ctxkeys added test file (typed-key round-trip; pkg has no statements so it reports [no statements]) - root package 32.1% -> 96.1% (extracted run()/bootstrap()/realMain() + signalContext()/netListen() seams from main so the boot -> ready -> teardown path, the os.Exit-class error arms, and the gRPC serve-error arm are testable without spawning a process or sending real signals) Production changes are behavior-preserving indirection seams only (tickInterval default = 30s; netListen = net.Listen; newExporter/ newResource wrap the real OTel ctors; main delegates to realMain). DB-touching tests gate on TEST_PROVISIONER_DATABASE_URL and skip when unset. Full `make gate` (build + vet + go test ./... -short) green. 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
Drives the provisioner's POOL + ROOT + CIRCUIT (plus telemetry/ctxkeys) packages to ≥95% statement coverage. Scope deliberately excludes backend/postgres, backend/mongo, backend/queue, backend/redis, server, and handlers (owned by other agents).
internal/poolinternal/circuitinternal/telemetryinternal/ctxkeysmainRun seam)What's covered
migrate/Start/Claim/Stats/fillPool/provisionOneItem), per-type backend arms, failing-backend + closed-pool error paths, periodic-tick refill.isCallerDeadline(nil), half-open→reopenonOpencallback.run()/bootstrap()/realMain()+signalContext()/netListen()seams frommainso boot→ready→teardown, theos.Exit-class error arms, the pool-enabled path, and the gRPC serve-error arm are all testable without spawning a process or real signals.Production changes
Behavior-preserving indirection seams only:
pool.Manager.tickInterval(defaults to 30s — prod unchanged)telemetry.newExporter/newResourcewrap the real OTel ctorsmaindelegates torealMain;netListen = net.ListenTest plan
internal/circuit100%,internal/telemetry98.3%,internal/pool96.4%, root 96.1%make gateequivalent (build + vet +go test ./... -short -p 1) green — all 17 packages pass, no regressionsTEST_PROVISIONER_DATABASE_URLand skip cleanly when unset🤖 Generated with Claude Code