Skip to content

Commit 0233d56

Browse files
committed
removing unnecessary code
1 parent 8763ff1 commit 0233d56

4 files changed

Lines changed: 25 additions & 23 deletions

File tree

google/cloud/storage/internal/tracing_connection.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
#include "google/cloud/storage/parallel_upload.h"
1919
#include "google/cloud/internal/opentelemetry.h"
2020
#include "google/cloud/internal/rest_pure_background_threads_impl.h"
21-
#include <algorithm>
2221
#include <memory>
2322
#include <string>
2423
#include <utility>

google/cloud/storage/internal/tracing_connection_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ TEST(TracingClientTest, Options) {
6767
TEST(TracingClientTest, CustomAsyncRunner) {
6868
TracingConnection::ResetCacheForTesting();
6969
bool invoked = false;
70-
auto runner = [&invoked](std::function<void()> f) {
70+
auto runner = [&invoked](std::function<void()> const& f) {
7171
invoked = true;
7272
f();
7373
};

google/cloud/storage/tests/object_plenty_clients_serially_integration_test.cc

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include "google/cloud/storage/testing/storage_integration_test.h"
1818
#include "google/cloud/internal/getenv.h"
1919
#include "google/cloud/log.h"
20-
#include "google/cloud/opentelemetry_options.h"
2120
#include "google/cloud/status_or.h"
2221
#include "google/cloud/testing_util/expect_exception.h"
2322
#include "google/cloud/testing_util/status_matchers.h"
@@ -44,18 +43,26 @@ TEST_F(ObjectPlentyClientsSeriallyIntegrationTest, PlentyClientsSerially) {
4443
// own tests.
4544
if (UsingGrpc()) GTEST_SKIP();
4645

47-
auto options =
48-
Options{}.set<google::cloud::OpenTelemetryTracingOption>(false);
46+
// With the advent of Regional Access Boundaries, connecting to non-regional
47+
// endpoints requires background calls to IAM. These background calls use
48+
// additional file descriptors which causes this test to fail when using the
49+
// default endpoint.
50+
auto regional_bucket = google::cloud::internal::GetEnv(
51+
"GOOGLE_CLOUD_CPP_STORAGE_TEST_DESTINATION");
52+
if (!regional_bucket.has_value()) GTEST_SKIP();
53+
bucket_name_ = *regional_bucket;
54+
// The regional_bucket was created in the us-west2 region.
55+
auto options = Options{}.set<RestEndpointOption>(
56+
"https://storage.us-west2.rep.googleapis.com");
57+
auto client = MakeIntegrationTestClient(options);
58+
4959
auto object_name = MakeRandomObjectName();
5060
std::string expected = LoremIpsum();
5161

52-
{
53-
auto client = MakeIntegrationTestClient(options);
54-
StatusOr<ObjectMetadata> meta = client.InsertObject(
55-
bucket_name_, object_name, expected, IfGenerationMatch(0));
56-
ASSERT_STATUS_OK(meta);
57-
ScheduleForDelete(*meta);
58-
}
62+
StatusOr<ObjectMetadata> meta = client.InsertObject(
63+
bucket_name_, object_name, expected, IfGenerationMatch(0));
64+
ASSERT_STATUS_OK(meta);
65+
ScheduleForDelete(*meta);
5966

6067
// Track the number of open files to ensure every client creates the same
6168
// number of file descriptors and none are leaked.

google/cloud/storage/tests/object_plenty_clients_simultaneously_integration_test.cc

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "google/cloud/storage/testing/object_integration_test.h"
1717
#include "google/cloud/storage/testing/storage_integration_test.h"
1818
#include "google/cloud/log.h"
19-
#include "google/cloud/opentelemetry_options.h"
2019
#include "google/cloud/status_or.h"
2120
#include "google/cloud/testing_util/expect_exception.h"
2221
#include "google/cloud/testing_util/status_matchers.h"
@@ -46,24 +45,21 @@ TEST_F(ObjectPlentyClientsSimultaneouslyIntegrationTest,
4645
// own tests.
4746
if (UsingGrpc()) GTEST_SKIP();
4847

49-
auto options =
50-
Options{}.set<google::cloud::OpenTelemetryTracingOption>(false);
48+
auto client = MakeIntegrationTestClient();
5149
auto object_name = MakeRandomObjectName();
5250
std::string expected = LoremIpsum();
5351

54-
{
55-
auto client = MakeIntegrationTestClient(options);
56-
StatusOr<ObjectMetadata> meta = client.InsertObject(
57-
bucket_name_, object_name, expected, IfGenerationMatch(0));
58-
ASSERT_STATUS_OK(meta);
59-
ScheduleForDelete(*meta);
60-
}
52+
// Create the object, but only if it does not exist already.
53+
StatusOr<ObjectMetadata> meta = client.InsertObject(
54+
bucket_name_, object_name, expected, IfGenerationMatch(0));
55+
ASSERT_STATUS_OK(meta);
56+
ScheduleForDelete(*meta);
6157

6258
auto num_fds_before_test = GetNumOpenFiles();
6359
std::vector<Client> read_clients;
6460
std::vector<ObjectReadStream> read_streams;
6561
for (int i = 0; i != 100; ++i) {
66-
auto read_client = MakeIntegrationTestClient(options);
62+
auto read_client = MakeIntegrationTestClient();
6763
auto stream = read_client.ReadObject(bucket_name_, object_name);
6864
char c;
6965
stream.read(&c, 1);

0 commit comments

Comments
 (0)