test(provisioner): real-backend gRPC round-trips for Mongo/Queue/Storage (Wave 4)#47
Merged
Merged
Conversation
…age (Wave 4) Closes the remaining cells of the provisioner gRPC × backend matrix (INTEGRATION-COVERAGE-PLAN §2.3 / Wave 4). Postgres + Redis server-layer round-trips already shipped (#45, #46); this adds the real-backend Provision → assert artifact → Deprovision → assert-gone lifecycle for the three remaining backends, all driven through the genuine gRPC handlers (breaker wrapping, tier routing, mapError, response shaping): - Mongo: ProvisionResource creates usr_/db_ on a real MongoDB, GetStorageBytes reads real dbStats (>0 after seeding), DeprovisionResource runs the real dropUser/dropDatabase (truehomie DROP-incident class), second Deprovision is a clean idempotent no-op, and Regrade(mongo) asserts the documented skip path. - Queue (NATS): ProvisionResource passes the real NATS monitor health check and returns nats:// URL + subject prefix, GetStorageBytes(queue)=0 (message-metered), Deprovision is the shared-backend no-op, idempotent. - Storage (MinIO/S3): GetStorageBytes object-walk — empty prefix=0, after a real PutObject=exact byte count, after delete=0. (Storage Provision/Deprovision are API-side; provisioner only meters.) All tests env-gated (skip cleanly under `go test -short`, the deploy gate; run for real when the backend env is present). CI: added NATS service container + MinIO docker-run step + the TEST_NATS_HOST / TEST_MINIO_* / CUSTOMER_MONGO_AUTH_URL env wiring to coverage.yml so they execute (mongo was already provided). Verified locally against real mongo/nats/minio containers: all 8 server round-trip tests PASS; integration-only coverage for internal/server = 99.2% (provisionMongo/provisionQueue/GetStorageBytes/DeprovisionResource/RegradeResource all 100%). No bug found in the destroy/regrade paths. Added INTEGRATION-COVERAGE-EXCLUSIONS.md documenting the ≥80 floor method + the only genuinely-unreachable lines (k8s dedicated-backend boot wiring, cmd/ entrypoints). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The minimal nats:2 image has no wget/curl/nc, so the service-container
--health-cmd ('wget ... :8222/healthz') could never pass — GitHub Actions
marked the container unhealthy and aborted the coverage job before any test
ran (NATS logged 'Server is ready'). Mirror the MinIO pattern: docker run
nats:2 -js -m 8222 + a runner-side curl wait on /healthz. Unblocks #47.
Co-Authored-By: Claude Opus 4.8 (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.
What
Closes the remaining cells of the provisioner gRPC × backend matrix (INTEGRATION-COVERAGE-PLAN §2.3 / Wave 4). Postgres + Redis server-layer round-trips already shipped (#45, #46); this PR adds the real-backend
Provision → assert artifact → Deprovision → assert-gonelifecycle for the three remaining backends — Mongo, Queue (NATS), Storage (MinIO/S3) — all driven through the genuine gRPC handlers (ProvisionResource/DeprovisionResource/GetStorageBytes/RegradeResource), not fakes.Inventory (before → after)
Provisioner RPC surface =
ProvisionResource,DeprovisionResource,GetStorageBytes,RegradeResource(protoprovisioner/v1). Storage Provision/Deprovision are intentionally API-side; the provisioner only meters storage.Tests added (
internal/server/server_live_roundtrip_mqs_test.go)usr_/db_on real MongoDB; GetStorageBytes reads realdbStats(>0 after seeding a 4KB doc); Deprovision runs realdropUser/dropDatabase(truehomie DROP-incident class); 2nd Deprovision is a clean idempotent no-op; Regrade(mongo) asserts the documented skip path.:8222/healthzmonitor check + returnsnats://URL + subject prefix; GetStorageBytes(queue)=0 (message-metered); Deprovision is the shared-backend no-op, idempotent; Regrade skip.PutObject=exact byte count (8192), after delete=0.All env-gated: skip cleanly under
go test -short(the deploy gate); run for real when backend env is present.CI (
.github/workflows/coverage.yml)Added a NATS service container (JetStream + monitor
:8222) and a MinIOdocker runstep (services can't passserver /data), plus env wiringTEST_NATS_HOST/TEST_MINIO_*/CUSTOMER_MONGO_AUTH_URLso the new tests execute. Mongo was already provided.Integration-only coverage (touched package)
internal/serverwith all backends wired: 99.2% of statements. The five exercised handlers (provisionMongo,provisionQueue,GetStorageBytes,DeprovisionResource,RegradeResource) are all 100%. Method:go test ./internal/server/ -coverpkg=./internal/server/... -coverprofile=… -count=1per the PLAN's mechanism C. The ≥80 integration floor is computed after subtracting the lines in the newINTEGRATION-COVERAGE-EXCLUSIONS.md(only k8s dedicated-backend boot wiring +cmd/entrypoints — genuinely unreachable without a live kube-apiserver / forking the binary).Verification
Ran all 8 server round-trip tests against real mongo/nats/minio/postgres/redis containers locally — all PASS. Failing-then-passing confirmed (mutated the storage expected-byte literal and the mongo
>0assert → both FAIL as expected, restored → PASS). Gate green:make gate(build + vet +go test ./... -short).Bug found
None. The destroy/regrade paths for all three backends behaved correctly and idempotently end-to-end (relevant to the truehomie DROP-incident class — no partial-cleanup leak observed).
🤖 Generated with Claude Code