test(gcp): align mock harness with production client lifecycle#584
test(gcp): align mock harness with production client lifecycle#584cristim wants to merge 1 commit into
Conversation
…#251) Fix four divergences between the GCP mock harness and production code: - provider_test: GetServiceClient_UnsupportedService used ServiceCache (now supported via Memorystore); switch to a genuinely unsupported type. Add GetServiceClient_ServiceCache to verify Memorystore wiring. - provider_test: IsConfigured_WithMock and ValidateCredentials_WithMock asserted injected clients are closed; production intentionally does not close injected clients (injector owns the lifecycle per godoc). - memorystore/client_test: GetExistingCommitments tests exercised ListInstances filtering that the production stub never performs; replace with TestGetExistingCommitments_Stub that pins the documented nil,nil return and asserts the redis service is never called. - cloudsql/client_test: ValidateOffering_NoCredentials relied on absent ADC (fragile on machines with application default credentials); replace with ValidateOffering_TierListError using an injected mock.
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Summary
Fix four divergences between the GCP mock harness and production code:
provider_test:GetServiceClient_UnsupportedServiceusedServiceCache(now supported via Memorystore); changed to a genuinely unsupported type. AddedGetServiceClient_ServiceCacheto verify Memorystore wiringprovider_test:IsConfigured_WithMockandValidateCredentials_WithMockasserted injected clients are closed; production intentionally does not close injected clients (injector owns the lifecycle per godoc)memorystore/client_test: tests exercisedListInstancesfiltering that the production stub never performs; replaced withTestGetExistingCommitments_Stubthat pins the documentednil, nilreturn and asserts the redis service is never calledcloudsql/client_test:ValidateOffering_NoCredentialsrelied on absent ADC credentials (fragile on machines with ADC configured); replaced with injected mock that explicitly errorsCloses #251
Test plan
go test ./...inproviders/gcp/)