Skip to content

test(coverage): drive pool/circuit/telemetry/ctxkeys/root to ≥95%#27

Merged
mastermanas805 merged 1 commit into
masterfrom
coverage/prov-pool-root-circuit-95
May 22, 2026
Merged

test(coverage): drive pool/circuit/telemetry/ctxkeys/root to ≥95%#27
mastermanas805 merged 1 commit into
masterfrom
coverage/prov-pool-root-circuit-95

Conversation

@mastermanas805
Copy link
Copy Markdown
Member

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).

package before after
internal/pool 26.3% 96.4%
internal/circuit 94.9% 100.0%
internal/telemetry 80.4% 98.3%
internal/ctxkeys no tests test file added (pkg has no statements)
root (main Run seam) 32.1% 96.1%

What's covered

  • pool: full DB-integration lifecycle (migrate/Start/Claim/Stats/fillPool/provisionOneItem), per-type backend arms, failing-backend + closed-pool error paths, periodic-tick refill.
  • circuit: constructor clamps, isCallerDeadline(nil), half-open→reopen onOpen callback.
  • telemetry: plaintext/TLS endpoint arms, NR-license header arm, exporter/resource construction-error arms.
  • root: extracted run()/bootstrap()/realMain() + signalContext()/netListen() seams from main so boot→ready→teardown, the os.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/newResource wrap the real OTel ctors
  • main delegates to realMain; netListen = net.Listen

Test plan

  • internal/circuit 100%, internal/telemetry 98.3%, internal/pool 96.4%, root 96.1%
  • Full make gate equivalent (build + vet + go test ./... -short -p 1) green — all 17 packages pass, no regressions
  • DB-touching tests gate on TEST_PROVISIONER_DATABASE_URL and skip cleanly when unset

🤖 Generated with Claude Code

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>
@mastermanas805 mastermanas805 merged commit bf1e496 into master May 22, 2026
9 of 10 checks passed
@mastermanas805 mastermanas805 deleted the coverage/prov-pool-root-circuit-95 branch May 22, 2026 02:53
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