Skip to content

Commit 2b0e63b

Browse files
committed
rename testbench to emulator in *.[cc/h]
enable test against emulator for `TEST_F(ObjectFileIntegrationTest, UploadFileBinary)`
1 parent d90a969 commit 2b0e63b

18 files changed

Lines changed: 59 additions & 61 deletions

google/cloud/storage/client_options.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ std::string XmlEndpoint(ClientOptions const& options) {
4747
}
4848

4949
std::string IamEndpoint(ClientOptions const& options) {
50-
auto testbench = GetEnv("CLOUD_STORAGE_EMULATOR_ENDPOINT");
51-
if (testbench) return *testbench + "/iamapi";
50+
auto emulator = GetEnv("CLOUD_STORAGE_EMULATOR_ENDPOINT");
51+
if (emulator) return *emulator + "/iamapi";
5252
return options.iam_endpoint();
5353
}
5454

google/cloud/storage/client_options_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ TEST_F(ClientOptionsTest, EndpointsOverride) {
151151
internal::IamEndpoint(options));
152152
}
153153

154-
TEST_F(ClientOptionsTest, EndpointsTestBench) {
154+
TEST_F(ClientOptionsTest, EndpointsEmulator) {
155155
testing_util::ScopedEnvironment endpoint("CLOUD_STORAGE_EMULATOR_ENDPOINT",
156156
"http://localhost:1234");
157157
ClientOptions options(oauth2::CreateAnonymousCredentials());

google/cloud/storage/examples/storage_examples_common_test.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ TEST(StorageExamplesCommon, RandomObject) {
4343
}
4444

4545
TEST(StorageExamplesCommon, CreateCommandEntryUsage) {
46-
// Set the client to use the testbench, this avoids any problems trying to
46+
// Set the client to use the emulator, this avoids any problems trying to
4747
// find and load the default credentials file.
4848
google::cloud::testing_util::ScopedEnvironment env(
4949
"CLOUD_STORAGE_EMULATOR_ENDPOINT", "http://localhost:9090");
@@ -72,7 +72,7 @@ TEST(StorageExamplesCommon, CreateCommandEntryUsage) {
7272
}
7373

7474
TEST(StorageExamplesCommon, CreateCommandEntryNoArguments) {
75-
// Set the client to use the testbench, this avoids any problems trying to
75+
// Set the client to use the emulator, this avoids any problems trying to
7676
// find and load the default credentials file.
7777
google::cloud::testing_util::ScopedEnvironment env(
7878
"CLOUD_STORAGE_EMULATOR_ENDPOINT", "http://localhost:9090");
@@ -112,7 +112,7 @@ TEST(StorageExamplesCommon, CreateCommandEntryNoArguments) {
112112
}
113113

114114
TEST(StorageExamplesCommon, CreateCommandEntryVarargs) {
115-
// Set the client to use the testbench, this avoids any problems trying to
115+
// Set the client to use the emulator, this avoids any problems trying to
116116
// find and load the default credentials file.
117117
google::cloud::testing_util::ScopedEnvironment env(
118118
"CLOUD_STORAGE_EMULATOR_ENDPOINT", "http://localhost:9090");

google/cloud/storage/internal/retry_object_read_source.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ StatusOr<ReadSourceResult> RetryObjectReadSource::Read(char* buf,
7171
if (handle_result(result)) {
7272
return result;
7373
}
74-
bool has_testbench_instructions = false;
74+
bool has_emulator_instructions = false;
7575
std::string instructions;
7676
if (request_.HasOption<CustomHeader>()) {
7777
auto name = request_.GetOption<CustomHeader>().custom_header_name();
78-
has_testbench_instructions = (name == "x-goog-emulator-instructions");
78+
has_emulator_instructions = (name == "x-goog-emulator-instructions");
7979
instructions = request_.GetOption<CustomHeader>().value();
8080
}
8181

@@ -92,7 +92,7 @@ StatusOr<ReadSourceResult> RetryObjectReadSource::Read(char* buf,
9292
// already be exhausted, so we should fail this operation too.
9393
child_.reset();
9494

95-
if (has_testbench_instructions) {
95+
if (has_emulator_instructions) {
9696
request_.set_multiple_options(
9797
CustomHeader("x-goog-emulator-instructions",
9898
instructions + "/retry-" + std::to_string(++counter)));

google/cloud/storage/testing/storage_integration_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ StorageIntegrationTest::MakeIntegrationTestClient(
104104

105105
std::unique_ptr<BackoffPolicy> StorageIntegrationTest::TestBackoffPolicy() {
106106
std::chrono::milliseconds initial_delay(std::chrono::seconds(1));
107-
auto constexpr kShortDelayForTestbench = std::chrono::milliseconds(10);
107+
auto constexpr kShortDelayForEmulator = std::chrono::milliseconds(10);
108108
if (UsingEmulator()) {
109-
initial_delay = kShortDelayForTestbench;
109+
initial_delay = kShortDelayForEmulator;
110110
}
111111

112112
auto constexpr kMaximumBackoffDelay = std::chrono::minutes(5);

google/cloud/storage/testing/storage_integration_test.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class StorageIntegrationTest : public ::testing::Test {
3737
/**
3838
* Return a client suitable for most integration tests.
3939
*
40-
* Most integration tests, particularly when running against the testbench,
40+
* Most integration tests, particularly when running against the emulator,
4141
* should use short backoff and retry periods. This returns a client so
4242
* configured.
4343
*/

google/cloud/storage/tests/bucket_integration_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ TEST_F(BucketIntegrationTest, CreateFailure) {
889889
ASSERT_STATUS_OK(client);
890890

891891
// Try to create an invalid bucket (the name should not start with an
892-
// uppercase letter), the service (or testbench) will reject the request and
892+
// uppercase letter), the service (or emulator) will reject the request and
893893
// we should report that error correctly. For good measure, make the project
894894
// id invalid too.
895895
StatusOr<BucketMetadata> meta = client->CreateBucketForProject(

google/cloud/storage/tests/key_file_integration_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class KeyFileIntegrationTest
3232
public ::testing::WithParamInterface<std::string> {
3333
protected:
3434
void SetUp() override {
35-
// The testbench does not implement signed URLs.
35+
// The emulator does not implement signed URLs.
3636
if (UsingEmulator()) GTEST_SKIP();
3737

3838
std::string const key_file_envvar = GetParam();

google/cloud/storage/tests/object_basic_crud_integration_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,21 +151,21 @@ TEST_F(ObjectBasicCRUDIntegrationTest, BasicCRUD) {
151151
}
152152

153153
StatusOr<Client> CreateNonDefaultClient() {
154-
auto testbench =
154+
auto emulator =
155155
google::cloud::internal::GetEnv("CLOUD_STORAGE_EMULATOR_ENDPOINT");
156156
google::cloud::testing_util::ScopedEnvironment env(
157157
"CLOUD_STORAGE_EMULATOR_ENDPOINT", {});
158158
auto options = ClientOptions(oauth2::CreateAnonymousCredentials());
159-
if (!testbench) {
159+
if (!emulator) {
160160
// Use a different spelling of the default endpoint. This disables the
161161
// allegedly "slightly faster" XML endpoints, but should continue to work.
162162
options.set_endpoint("https://storage.googleapis.com:443");
163163
auto creds = oauth2::GoogleDefaultCredentials();
164164
if (!creds) return std::move(creds).status();
165165
options.set_credentials(*std::move(creds));
166166
} else {
167-
// Use the testbench endpoint, but not through the environment variable
168-
options.set_endpoint(*testbench);
167+
// Use the emulator endpoint, but not through the environment variable
168+
options.set_endpoint(*emulator);
169169
options.set_credentials(oauth2::CreateAnonymousCredentials());
170170
}
171171
return Client(options);

google/cloud/storage/tests/object_checksum_integration_test.cc

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ TEST_F(ObjectChecksumIntegrationTest, DefaultCrc32cInsertJSON) {
204204
Contains(StartsWith("content-type: multipart/related; boundary=")));
205205

206206
if (insert_meta->has_metadata("x_emulator_upload")) {
207-
// When running against the testbench, we have some more information to
207+
// When running against the emulator, we have some more information to
208208
// verify the right upload type and contents were sent.
209209
EXPECT_EQ("multipart", insert_meta->metadata("x_emulator_upload"));
210210
ASSERT_TRUE(insert_meta->has_metadata("x_emulator_crc32c"));
@@ -296,8 +296,8 @@ TEST_F(ObjectChecksumIntegrationTest, DefaultCrc32cStreamingWriteJSON) {
296296
/// @test Verify that CRC32C checksum mismatches are reported by default on
297297
/// downloads.
298298
TEST_F(ObjectChecksumIntegrationTest, MismatchedCrc32cStreamingReadXML) {
299-
// This test is disabled when not using the testbench as it relies on the
300-
// testbench to inject faults.
299+
// This test is disabled when not using the emulator as it relies on the
300+
// emulator to inject faults.
301301
if (!UsingEmulator()) GTEST_SKIP();
302302
StatusOr<Client> client = MakeIntegrationTestClient();
303303
ASSERT_STATUS_OK(client);
@@ -340,8 +340,8 @@ TEST_F(ObjectChecksumIntegrationTest, MismatchedCrc32cStreamingReadXML) {
340340
/// @test Verify that CRC32C checksum mismatches are reported by default on
341341
/// downloads.
342342
TEST_F(ObjectChecksumIntegrationTest, MismatchedCrc32cStreamingReadJSON) {
343-
// This test is disabled when not using the testbench as it relies on the
344-
// testbench to inject faults.
343+
// This test is disabled when not using the emulator as it relies on the
344+
// emulator to inject faults.
345345
if (!UsingEmulator()) GTEST_SKIP();
346346
StatusOr<Client> client = MakeIntegrationTestClient();
347347
ASSERT_STATUS_OK(client);
@@ -384,8 +384,8 @@ TEST_F(ObjectChecksumIntegrationTest, MismatchedCrc32cStreamingReadJSON) {
384384
/// @test Verify that CRC32C checksum mismatches are reported when using
385385
/// .read().
386386
TEST_F(ObjectChecksumIntegrationTest, MismatchedMD5StreamingReadXMLRead) {
387-
// This test is disabled when not using the testbench as it relies on the
388-
// testbench to inject faults.
387+
// This test is disabled when not using the emulator as it relies on the
388+
// emulator to inject faults.
389389
if (!UsingEmulator()) GTEST_SKIP();
390390
StatusOr<Client> client = MakeIntegrationTestClient();
391391
ASSERT_STATUS_OK(client);
@@ -420,8 +420,8 @@ TEST_F(ObjectChecksumIntegrationTest, MismatchedMD5StreamingReadXMLRead) {
420420
/// @test Verify that CRC32C checksum mismatches are reported when using
421421
/// .read().
422422
TEST_F(ObjectChecksumIntegrationTest, MismatchedMD5StreamingReadJSONRead) {
423-
// This test is disabled when not using the testbench as it relies on the
424-
// testbench to inject faults.
423+
// This test is disabled when not using the emulator as it relies on the
424+
// emulator to inject faults.
425425
if (!UsingEmulator()) GTEST_SKIP();
426426
StatusOr<Client> client = MakeIntegrationTestClient();
427427
ASSERT_STATUS_OK(client);
@@ -457,8 +457,8 @@ TEST_F(ObjectChecksumIntegrationTest, MismatchedMD5StreamingReadJSONRead) {
457457
/// @test Verify that CRC32C checksum mismatches are reported by default on
458458
/// downloads.
459459
TEST_F(ObjectChecksumIntegrationTest, MismatchedCrc32cStreamingWriteJSON) {
460-
// This test is disabled when not using the testbench as it relies on the
461-
// testbench to inject faults.
460+
// This test is disabled when not using the emulator as it relies on the
461+
// emulator to inject faults.
462462
if (!UsingEmulator()) GTEST_SKIP();
463463
StatusOr<Client> client = MakeIntegrationTestClient();
464464
ASSERT_STATUS_OK(client);

0 commit comments

Comments
 (0)