Repository navigation
feat(storagecontrol): add Rapid Cache samples - #14724
Draft
sahusneha2004 wants to merge 3 commits into
Draft
sahusneha2004 wants to merge 3 commits into
sahusneha2004 wants to merge 3 commits into
Conversation
Adds samples for the Storage Control Rapid Cache CRUD APIs: storage_control_create_rapid_cache, storage_control_get_rapid_cache, storage_control_list_rapid_caches, storage_control_update_rapid_cache, storage_control_disable_rapid_cache. Bumps google-cloud-storage-control to 1.17.0. Refs b/482946642 [Generated-by: AI]
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces support for managing Rapid Caches in Google Cloud Storage Control. It adds scripts to create, disable, get, list, and update Rapid Caches, along with corresponding integration tests and test fixtures in conftest.py. Additionally, the google-cloud-storage-control dependency in requirements.txt is updated to version 1.17.0. There are no review comments to address, and I have no further feedback to provide.
Draft
6 of 9 tasks
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]
Reorder imports in storagecontrol/conftest.py and storagecontrol/rapid_cache_test.py to match the repository-root flake8-import-order configuration used by the GitHub Actions Lint workflow. [Generated-by: AI]
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.
Description
Adds Python samples for the Storage Control API Rapid Cache CRUD operations:
storage_control_create_rapid_cachestoragecontrol/create_rapid_cache.pystorage_control_get_rapid_cachestoragecontrol/get_rapid_cache.pystorage_control_list_rapid_cachesstoragecontrol/list_rapid_caches.pystorage_control_update_rapid_cachestoragecontrol/update_rapid_cache.pystorage_control_disable_rapid_cachestoragecontrol/disable_rapid_cache.pyAlso:
google-cloud-storage-controlto1.17.0, the released version that includes the Rapid Cache RPCs.rapid_cache_test.py, a system test covering create → get → list → update → disable, plus two new fixtures inconftest.py:rapid_cache_zone(defaultus-central1-a, overridable via theRAPID_CACHE_ZONEenv var) andregional_hns_enabled_bucket.Refs b/482946642
Behavior notes (observed against the live API)
rapid-cache-ultracache. Creatingrapid-cachecurrently returns400 Rapid Cache management operations are not supported at this time. Rapid Cache Ultra requires a bucket with hierarchical namespace enabled in a single region; a multi-region bucket returnsRapid Cache feature is disabled.projects/_/buckets/<bucket>/rapidCaches/<id>, where<id>is currently the zone. Get, update and disable take(bucket_name, cache_id). The test parses the ID from the returned name and does not assume it equals the zone.ttlto 2 days withupdate_mask=["ttl"].admit-on-second-missis rejected for Rapid Cache Ultra.disabledstate within seconds, but the disable LRO only completes once the cache is fully removed. That did not happen within 30 minutes in testing. The sample prints the cache and operation names and points toget_rapid_cachefor checking state. The test polls get (up to 2 minutes) until it seesState: disabled.409 The bucket you tried to delete has Rapid Cache Ultra). The fixture retries deletion on 409 for 2 minutes, then logs a warning and leaves the bucket behind. The repo has no stale-bucket sweeper, so leftoverstoragecontrol-samples-*buckets in the test project need periodic cleanup.BUILD_SPECIFIC_GCLOUD_PROJECT) must be allowlisted for Rapid Cache Ultra in the test zone; otherwise create will fail. I found no existing Anywhere Cache or long-LRO skip precedent in this repo.Checklist
rapid_cache_test.pypassed against a live allowlisted project (storage-prober-prelaunch-acv2)nox -s lint.snippets_test.pyandmanaged_folder_list_test.py, which this PR does not touch, have existing flake8 import-order errors (I100/I201) that makenox -s lintfail for thestoragecontrol/directory. I left them out of scope.enforce_type_hints=True)Generated with the
storage-sample-architectworkflow. This Python implementation is the golden reference for the other languages.Update: aligned with googleapis/google-cloud-java#14529
The samples now follow the API usage in the reference integration test (
ITRapidCacheTest.java). Where this conflicts with the Cache ID and Disable behavior notes above, this section takes precedence.projects/_/buckets/{bucket}/rapidCaches/{zone}(the backend requires the cache ID to equal the zone), pluscache_type="rapid-cache-ultra"andttl=86400s(24h). Prints the name, state and cache type.timeoutparam (defaultNonewaits until it finishes) and prints the returned cache and its state.cache_idis the zone. After create and after get, it checks for staterunningand cache typerapid-cache-ultra. It also checks the cache is listed and that ttl is 172800s after update. The disable wait is capped at 600s. On timeout, the test calls get and checks for statedisabledinstead of failing. If the test fails before the disable step, teardown starts a disable and ignores errors.disabled. Deleting the bucket returned 409 (has Rapid Cache Ultra), so the bucket was left in place as expected.