Skip to content

test(gcp): align mock harness with production client lifecycle#584

Open
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
fix/gcp-mock-harness-251
Open

test(gcp): align mock harness with production client lifecycle#584
cristim wants to merge 1 commit into
feat/multicloud-web-frontendfrom
fix/gcp-mock-harness-251

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented May 20, 2026

Summary

Fix four divergences between the GCP mock harness and production code:

  • provider_test: GetServiceClient_UnsupportedService used ServiceCache (now supported via Memorystore); changed to a genuinely unsupported type. Added 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: tests exercised ListInstances filtering that the production stub never performs; replaced 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 credentials (fragile on machines with ADC configured); replaced with injected mock that explicitly errors

Closes #251

Test plan

  • All 231 GCP provider Go tests pass (go test ./... in providers/gcp/)
  • Pre-commit hooks pass

…#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.
@cristim cristim added triaged Item has been triaged priority/p2 Backlog-worthy severity/medium Moderate harm urgency/this-quarter Within the quarter impact/internal Team-internal only labels May 20, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

Warning

Rate limit exceeded

@cristim has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minute and 58 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 57332ab3-3d0d-4fe8-9c31-a75fb286416a

📥 Commits

Reviewing files that changed from the base of the PR and between bc8831b and 4cbda91.

📒 Files selected for processing (3)
  • providers/gcp/provider_test.go
  • providers/gcp/services/cloudsql/client_test.go
  • providers/gcp/services/memorystore/client_test.go
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/gcp-mock-harness-251

Comment @coderabbitai help to get the list of available commands and usage tips.

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 20, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim cristim added type/bug Defect effort/m Days labels May 20, 2026
@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/m Days impact/internal Team-internal only priority/p2 Backlog-worthy severity/medium Moderate harm triaged Item has been triaged type/bug Defect urgency/this-quarter Within the quarter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant