Repository navigation
samples(storage-control): add Rapid Cache samples - #36687
Draft
sahusneha2004 wants to merge 2 commits into
Draft
sahusneha2004 wants to merge 2 commits into
sahusneha2004 wants to merge 2 commits into
Conversation
Adds create, get, list, update and disable Rapid Cache samples for Storage Control, with an acceptance test gated by STORAGE_CONTROL_RUN_RAPID_CACHE_TESTS. b/482946642 [Generated-by: AI]
…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]
This branch has not been deployed
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.
Adds Storage Control samples for Rapid Cache: create, get, list, update, and disable.
Region tags:
storage_control_create_rapid_cachestorage_control_get_rapid_cachestorage_control_list_rapid_cachesstorage_control_update_rapid_cachestorage_control_disable_rapid_cacheWhat each sample does:
rapid-cache-ultracache in a zone. It doesn't set a name; the server assigns the cache ID, and the sample prints the name it gets back.update_mask: ["ttl"].disabledwithin seconds, but the operation only finishes once the cache is fully removed, which takes more than 30 minutes.operations_client.get_operation.Gapic::Operation#wait_until_done!fails against this API:reload!resends the original call's options, including itsx-goog-request-paramsheader, so the server returnsINVALID_ARGUMENT: The x-goog-request-params must specify the same name as the resource in the request. Please don't switch these back towait_until_done!.Dependencies: bumps the samples
Gemfile.lockto google-cloud-storage-control-v2 1.15.0, the first release with the Rapid Cache RPCs, and google-cloud-storage-control 1.4.2. gapic-common (1.6.1) and grpc (1.85.0) were bumped along with them.Testing:
acceptance/storage_control_rapid_cache_test.rbruns the full flow on a regional HNS + UBLA bucket: create, get, list, update, disable, then check that the state becomesdisabled.STORAGE_CONTROL_RUN_RAPID_CACHE_TESTSis set, so it's skipped in CI like the Anywhere Cache test. The zone defaults tous-east1-b; setSTORAGE_CONTROL_RAPID_CACHE_ZONEto use another.The bucket you tried to delete has Rapid Cache Ultrafor a long time after the cache is disabled, so the test retries for about 2 minutes, then leaves the bucket for the stale-bucket sweeper and logs its name.bundle exec rubocopreports no offenses.b/482946642
Update: aligned with googleapis/google-cloud-java#14529
The samples now follow the API usage in the reference integration test (
ITRapidCacheTest.java). Where these points differ from the sections above, these points apply.projects/_/buckets/{bucket}/rapidCaches/{zone}. The backend requires the cache ID to be the same as the zone. It also setscache_type: "rapid-cache-ultra"andttl: 86400s(24h), and prints the name, cache type and TTL.cache_idin get, update and disable now say the ID is the same as the zone.operations_client.get_operation, the same way create and update do. It takes an optionaltimeout:in seconds (defaultnil, which means wait until done) and prints the disabled cache. The old "does not wait" comment is removed.cache_id = zone.rapid-cache-ultra, TTL 86400) and the get output (State: runningand cache type).ensurewithtimeout: 600. If it times out, the test checks with get that the state isdisabledinstead of failing.rapid_cache_ids_helperwas removed fromhelper.rb.disabledstate. The bucket was left for the stale-bucket sweeper, as expected.bundle exec rubocopreports no offenses.