Skip to content

Commit c4a1293

Browse files
committed
don't run ListBucketsPartialSuccess in production
1 parent ff6303f commit c4a1293

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

google/cloud/storage/client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ class Client {
389389
* This is a read-only operation and is always idempotent.
390390
*
391391
* @par Example
392-
* @snippet storage_bucket_samples.cc list buckets partial result
392+
* @snippet storage_bucket_samples.cc list buckets partial success
393393
*/
394394
template <typename... Options>
395395
ListBucketsExtendedReader ListBucketsExtended(Options&&... options) {

google/cloud/storage/examples/storage_bucket_samples.cc

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ void ListBuckets(google::cloud::storage::Client client,
4949
(std::move(client));
5050
}
5151

52-
void ListBucketsExtended(google::cloud::storage::Client client,
53-
std::vector<std::string> const& /*argv*/) {
54-
//! [list buckets partial result] [START storage_list_buckets_partial_success]
52+
void ListBucketsPartialSuccess(google::cloud::storage::Client client,
53+
std::vector<std::string> const& /*argv*/) {
54+
//! [list buckets partial success] [START
55+
//! storage_list_buckets_partial_success]
5556
namespace gcs = ::google::cloud::storage;
5657
using ::google::cloud::StatusOr;
5758
[](gcs::Client client) {
@@ -73,7 +74,7 @@ void ListBucketsExtended(google::cloud::storage::Client client,
7374
std::cout << "No buckets in default project\n";
7475
}
7576
}
76-
//! [list buckets partial result] [END storage_list_buckets_partial_success]
77+
//! [list buckets partial success] [END storage_list_buckets_partial_success]
7778
(std::move(client));
7879
}
7980

@@ -712,8 +713,8 @@ void RunAll(std::vector<std::string> const& argv) {
712713
std::cout << "\nRunning ListBuckets() example" << std::endl;
713714
ListBuckets(client, {});
714715

715-
std::cout << "\nRunning ListBucketsExtended() example" << std::endl;
716-
ListBucketsExtended(client, {});
716+
std::cout << "\nRunning ListBucketsPartialSuccess() example" << std::endl;
717+
ListBucketsPartialSuccess(client, {});
717718

718719
std::cout << "\nRunning CreateBucket() example" << std::endl;
719720
CreateBucket(client, {bucket_name});
@@ -758,8 +759,8 @@ int main(int argc, char* argv[]) {
758759

759760
examples::Example example({
760761
examples::CreateCommandEntry("list-buckets", {}, ListBuckets),
761-
examples::CreateCommandEntry("list-buckets-extended", {},
762-
ListBucketsExtended),
762+
examples::CreateCommandEntry("list-buckets-partial-success", {},
763+
ListBucketsPartialSuccess),
763764
examples::CreateCommandEntry("list-buckets-for-project", {"<project-id>"},
764765
ListBucketsForProject),
765766
make_entry("create-bucket", {}, CreateBucket),

google/cloud/storage/internal/connection_impl_bucket_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ TEST(StorageConnectionImpl, ListBucketsPartialResult) {
7474
ListBucketsRequest const& r) {
7575
EXPECT_TRUE(r.return_partial_success());
7676
ListBucketsResponse response;
77-
response.items.emplace_back(BucketMetadata{});
77+
response.items.emplace_back(BucketMetadata{}.set_name("bucket2"));
7878
response.unreachable.emplace_back("projects/_/buckets/bucket1");
7979
return response;
8080
});

google/cloud/storage/tests/bucket_integration_test.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,8 @@ TEST_F(BucketIntegrationTest, ListFailure) {
684684
}
685685

686686
TEST_F(BucketIntegrationTest, ListPartialSuccess) {
687+
// This test requires the emulator to simulate unreachable buckets.
688+
if (!UsingEmulator()) GTEST_SKIP();
687689
auto client = MakeIntegrationTestClient();
688690
std::string bucket_name = MakeRandomBucketName();
689691
std::string unreachable_bucket_name =

0 commit comments

Comments
 (0)