Repository navigation
feat(storagecontrol): add Rapid Cache samples - #14724
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]
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.
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]
- create_rapid_cache: set only the required fields (name, zone, cache_type) and leave TTL to the update sample; use a cache_id variable consistent with get/update. - tests: move cleanup into a rapid_cache_id fixture that disables the cache on teardown if it is still active, so cleanup runs even when assertions fail; keep the test flow linear without nested try/except/finally; bound the disable wait with the native operation timeout. - disable_rapid_cache: document that the operation completes only after the cache is fully removed. [Generated-by: AI]
|
Here is the summary of changes. You are about to add 5 region tags.
This comment is generated by snippet-bot.
|
|
CI triage: Kokoro failures are not caused by this PR All eight failing (The Python 3.x jobs show the same error for
No code changes are needed for these checks. A maintainer can merge once reviews are done, or retire the leftover Kokoro status contexts in the repo's required-checks settings. [Generated-by: AI] |
shradhakatyal
left a comment
There was a problem hiding this comment.
Thanks for adding the Rapid Cache samples. Overall structure and region tags look good.
I have a few comments below, mainly around:
- Avoid blocking indefinitely in
disable_rapid_cache.py. - Fix a 404 edge case and gate
rapid_cache_test.pyfor non-allowlisted projects. - Clean up
create_rapid_cache.pyand test fixture teardown/waits inconftest.py.
Also, please update the PR description to reflect only the final code. Several notes currently contradict HEAD (such as ttl on create, fixture count, and lint behavior).
- disable_rapid_cache: start the LRO without waiting; print the cache path and operation name and point users to get_rapid_cache. - create_rapid_cache: drop the unused RapidCache.name; note that Rapid Cache Ultra requires a regional HNS bucket. - get_rapid_cache: print the TTL when set. - Soften cache ID comments; the ID is not guaranteed to equal the zone. - rapid_cache_test: opt-in via RUN_RAPID_CACHE_TESTS=True; assert the disable output and tolerate NotFound when checking the disabled state. - conftest: validate RAPID_CACHE_ZONE, remove the 20s sleep, use a single best-effort bucket delete, and disable caches by name on teardown. [Generated-by: AI]
Description
Adds Python samples for the Storage Control API Rapid Cache 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 first released version with the Rapid Cache RPCs.rapid_cache_test.py, a system test that runs create → get → list → update → disable.conftest.py:rapid_cache_zone: defaults tous-central1-a, can be overridden withRAPID_CACHE_ZONE, and checks the zone format.regional_hns_enabled_bucketrapid_cache_idRefs b/482946642
Sample behavior
zoneandcache_type="rapid-cache-ultra". It does not setnameorttl; the TTL uses the server default. Rapid Cache Ultra requires a regional bucket with hierarchical namespace enabled. The sample waits for the create operation and prints the name, state and cache type.ttlwithupdate_mask=["ttl"]and prints the new TTL.disabledquickly. The operation only completes once the cache is fully removed, which can take more than an hour. Useget_rapid_cacheto check the state.Tests
rapid_cache_test.pyis skipped unlessRUN_RAPID_CACHE_TESTS=True, the same wayzonal_snippets_test.pyis gated. Rapid Cache Ultra needs an allowlisted project, and test buckets stay behind until the cache removal finishes.State: disabled, and acceptsNotFoundin case removal already finished.409 ... has Rapid Cache Ultra), it logs a warning and leaves the bucket. The test project needs periodic cleanup of leftoverstoragecontrol-samples-*buckets.Checklist
RUN_RAPID_CACHE_TESTS=True,rapid_cache_test.pypassed against an allowlisted project (storage-prober-prelaunch-acv2,us-central1-a) in about 17s. It is skipped when the variable is not set.blackandflake8with the GitHub Actions Lint config (.github/scripts/noxfile-lint.pyvialint-changed.sh). The older per-directorynox -s lintalso reports existing I100/I201 errors insnippets_test.pyandmanaged_folder_list_test.py, which this PR does not touch.enforce_type_hints=True)Generated with the
storage-sample-architectworkflow.