Skip to content

test(storage): Add integration tests for Storage Control RapidCache CRUD APIs - #14529

Merged
nidhiii-27 merged 7 commits into
mainfrom
feat/storage-control-rapidcache-crud
Nov 3, 2026
Merged

nidhiii-27 merged 7 commits into
mainfrom
feat/storage-control-rapidcache-crud

Conversation

@nidhiii-27

@nidhiii-27 nidhiii-27 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds integration tests for Rapid Cache Ultra (RCU) control plane operations (ITRapidCacheTest.java) using the StorageControlClient.

Scope & Operations Tested

  • Create: Creates a Rapid Cache instance on an HNS-enabled regional bucket.
  • Duplicate Prevention: Verifies that creating a duplicate cache with the same name fails appropriately (ALREADY_EXISTS or expected service error).
  • Get: Retrieves active cache metadata and verifies its state (running).
  • List: Confirms the created cache is returned when listing caches for the bucket.
  • Update: Updates cache TTL configuration and validates field mask application.
  • Disable & Teardown: Disables the Rapid Cache instance and defensively cleans up resources in @AfterClass.
  • Negative Testing: Validates handling for non-existent cache retrieval and invalid zone/cache configurations.

Verification

  • Formatted with google-java-format.
  • Clean compilation via mvn test-compile -Dtest=ITRapidCacheTest.
  • Modernized assertion patterns using assertThrows and Google Truth.

[Generated-by: AI]

…RUD APIs

Adds integration tests for Storage Control RapidCache CRUD operations in ITRapidCacheTest.java.

[Generated-by: AI]
@nidhiii-27 nidhiii-27 added the ai-generated Pull Request generated by AI label Sep 28, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new integration test class, ITRapidCacheTest, to verify the CRUD lifecycle and negative scenarios for the Storage Control RapidCache API. The review feedback highlights an improvement opportunity in the creation retry logic of rapidCache_crudLifecycle; instead of repeatedly calling the asynchronous creation API, which can cause rate limiting or unexpected backend behavior, the test should call it once and poll the get API until the resource is active.

@nidhiii-27 nidhiii-27 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 29, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Sep 29, 2026
@nidhiii-27
nidhiii-27 marked this pull request as ready for review September 29, 2026 10:09
@nidhiii-27
nidhiii-27 requested review from a team as code owners September 29, 2026 10:09
Resolve review feedback on RapidCache CRUD lifecycle test by invoking
createRapidCacheAsync once and polling getRapidCache until active.

[Generated-by: AI]
Remove temporary workarounds for b/564257939 in ITRapidCacheTest:
- Remove retry and polling workaround on createRapidCacheAsync in rapidCache_crudLifecycle
- Directly assert ExecutionException with cause ApiException(ALREADY_EXISTS) on duplicate cache creation
- Directly assert ApiException(INVALID_ARGUMENT) on invalid cache configuration

[Generated-by: AI]
…ndle unimplemented disable

- Split rapidCache_crudLifecycle into independent @test methods
- Share bucket and cache created in setUpClass across read-only tests
- Isolate createAndDisableRapidCache in a dedicated bucket with clean cleanup
- Gracefully handle UNIMPLEMENTED for DisableRapidCache via logging and Assume
- Add disableRapidCache_nonExistent negative test for full parity with C++ PR 16512
- Gracefully catch exceptions during tearDownClass cleanup

[Generated-by: AI]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed we are using a Thread.sleep(20000) here to wait for the bucket metadata to propagate. Out of curiosity, how was the 20-second value chosen?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 20-second delay was chosen empirically during integration testing due to cross-service metadata propagation.

The bucket is created via the standard Storage client, while RapidCache is provisioned via the separate Storage Control plane service (StorageControlClient). Because it takes a few seconds for newly created bucket metadata and its HNS configuration to propagate to the Control plane backends, attempting cache creation too quickly caused the service to throw FAILED_PRECONDITION (the bucket is not yet recognized as HNS-enabled) or UNAVAILABLE. A 20-second wait reliably ensures the metadata has settled across services, preventing test flakiness.

Co-authored by AI Agent

@nidhiii-27
nidhiii-27 requested a review from Dhriti07 October 6, 2026 06:54
Dhriti07 and others added 2 commits October 27, 2026 12:39
…pidCacheTest

Accommodate the current production DisableRapidCache LRO response where
DisableRapidCacheOpTypeHandler::GetOperationResponse returns a default
AnywhereCacheInstance (translating to name prefix 'projects/_/buckets/<bucket>/rapidCaches/'
and state 'anywhere-cache-state-unspecified') until CL 990396263 rolls out.

[Generated-by: AI]

@Dhriti07 Dhriti07 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Use Locale.ROOT with toLowerCase()

sahusneha2004 added a commit to GoogleCloudPlatform/php-docs-samples that referenced this pull request Nov 2, 2026
…ation test

Set the explicit cache name (ID = zone), cache_type rapid-cache-ultra and ttl 24h on create; wait for the disable LRO; tests assert running state, cache type, list membership and the updated ttl, and bound the disable wait. Aligns with googleapis/google-cloud-java#14529. b/482946642

[Generated-by: AI]
sahusneha2004 added a commit to googleapis/google-cloud-cpp that referenced this pull request Nov 2, 2026
…ation test

Set the explicit cache name (ID = zone), cache_type rapid-cache-ultra and ttl 24h on create; wait for the disable LRO; the auto-run asserts running state, cache type, list membership and the updated ttl, and bounds the disable wait. Aligns with googleapis/google-cloud-java#14529. b/482946642

[Generated-by: AI]
sahusneha2004 added a commit to googleapis/google-cloud-ruby that referenced this pull request Nov 2, 2026
…ration test

Set the explicit cache name (ID = zone), cache_type rapid-cache-ultra and ttl 24h on create; wait for the disable LRO; tests assert running state, cache type, list membership and the updated ttl, and bound the disable wait. Aligns with googleapis/google-cloud-java#14529. b/482946642

[Generated-by: AI]
sahusneha2004 added a commit to GoogleCloudPlatform/dotnet-docs-samples that referenced this pull request Nov 2, 2026
Set the explicit cache name (ID = zone), cache_type rapid-cache-ultra and ttl 24h on create; wait for the disable LRO; tests assert running state, cache type, list membership and the updated ttl, and bound the disable wait. Aligns with googleapis/google-cloud-java#14529. b/482946642

[Generated-by: AI]
sahusneha2004 added a commit to GoogleCloudPlatform/python-docs-samples that referenced this pull request Nov 2, 2026
Set the explicit cache name (ID = zone), cache_type rapid-cache-ultra and ttl 24h on create; wait for the disable LRO; tests assert running state, cache type, list membership and the updated ttl, and bound the disable wait. Aligns with googleapis/google-cloud-java#14529. b/482946642

[Generated-by: AI]
sahusneha2004 added a commit to googleapis/google-cloud-rust that referenced this pull request Nov 2, 2026
Set the explicit cache name (ID = zone), cache_type rapid-cache-ultra and ttl 24h on create; wait for the disable LRO; tests assert running state, cache type, list membership and the updated ttl, and bound the disable wait. Aligns with googleapis/google-cloud-java#14529. b/482946642

[Generated-by: AI]
sahusneha2004 added a commit that referenced this pull request Nov 2, 2026
Set the explicit cache name (ID = zone), cache_type rapid-cache-ultra and ttl 24h on create; wait for the disable LRO; tests assert running state, cache type, list membership and the updated ttl, and bound the disable wait. Aligns with #14529. b/482946642

[Generated-by: AI]
sahusneha2004 added a commit to GoogleCloudPlatform/golang-samples that referenced this pull request Nov 2, 2026
Set the explicit cache name (ID = zone), cache_type rapid-cache-ultra and ttl 24h on create; wait for the disable LRO; tests assert running state, cache type, list membership and the updated ttl, and bound the disable wait. Aligns with googleapis/google-cloud-java#14529. b/482946642

[Generated-by: AI]
…CU is in prod

Co-authored-by: Gemini CLI <218195315+gemini-cli@users.noreply.github.com>

[Generated-by: AI]
@nidhiii-27

Copy link
Copy Markdown
Contributor Author

Updated all toLowerCase() calls in ITRapidCacheTest to use Locale.ROOT. Also added @Ignore("TODO: Enable tests once RCU is available in prod") to skip the test suite until RCU is available in prod.

Co-authored by AI Agent

@nidhiii-27
nidhiii-27 merged commit aa38063 into main Nov 3, 2026
203 checks passed
@nidhiii-27
nidhiii-27 deleted the feat/storage-control-rapidcache-crud branch November 3, 2026 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull Request generated by AI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants