samples(storagecontrol): add delete folder recursive sample#16149
samples(storagecontrol): add delete folder recursive sample#16149nidhiii-27 wants to merge 1 commit into
Conversation
[Generated-by: AI]
There was a problem hiding this comment.
Code Review
This pull request adds a new DeleteFolderRecursive sample and integrates it into the sample runner and AutoRun test flow. A critical compilation issue was identified in the new sample: DeleteFolderRecursive().get() returns a google::cloud::Status rather than a StatusOr, so checking !deleted and calling .status() will fail to compile. The reviewer provided a code suggestion to use .ok() and throw the status directly.
| auto deleted = client.DeleteFolderRecursive(name).get(); | ||
| if (!deleted) throw std::move(deleted).status(); |
There was a problem hiding this comment.
The DeleteFolderRecursive function returns a google::cloud::future<google::cloud::Status>. Therefore, calling .get() returns a google::cloud::Status object, not a StatusOr. Since google::cloud::Status does not have an operator bool() or a .status() method, this code will fail to compile. It should check .ok() and throw the status directly.
auto status = client.DeleteFolderRecursive(name).get();
if (!status.ok()) throw std::move(status);References
- Prefer defensive code, such as explicit
ok()checks, even if they seem redundant based on the current implementation of a framework, as the framework's contract may change in the future.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16149 +/- ##
=======================================
Coverage 92.70% 92.70%
=======================================
Files 2353 2353
Lines 218352 218352
=======================================
+ Hits 202418 202425 +7
+ Misses 15934 15927 -7 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This PR adds the SDK sample and tests for the hierarchical namespace recursive delete feature, resolving b/521168740.