Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

impl: add integration tests for LRO Start and Await methods #14377

Merged

Conversation

scotthart
Copy link
Member

@scotthart scotthart commented Jun 26, 2024

part of the work for #7658


This change is Reviewable

@scotthart scotthart requested a review from a team as a code owner June 26, 2024 21:03
Copy link

codecov bot commented Jun 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.06%. Comparing base (42336db) to head (d056181).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14377   +/-   ##
=======================================
  Coverage   93.06%   93.06%           
=======================================
  Files        2191     2191           
  Lines      193203   193203           
=======================================
+ Hits       179812   179814    +2     
+ Misses      13391    13389    -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

ASSERT_THAT(result, testing_util::IsOk());
auto start_result = client.InsertDisk(ExperimentalTag{}, NoAwaitTag{},
project_id_, zone_, disk);
ASSERT_THAT(start_result, testing_util::IsOk());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit (predates this PR): using ::google::cloud::testing_util::IsOk()

Comment on lines 96 to 102
std::string operation_string;
EXPECT_TRUE(start_result->SerializeToString(&operation_string));

google::cloud::cpp::compute::v1::Operation operation;
EXPECT_TRUE(operation.ParseFromString(operation_string));

auto await_result = client.InsertDisk(ExperimentalTag{}, operation).get();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the string serializing/parsing?

  auto operation = client.InsertDisk(ExperimentalTag{}, NoAwaitTag{},
                                        project_id_, zone_, disk);
  ASSERT_THAT(operation, IsOk());
  auto result = client.InsertDisk(ExperimentalTag{}, *operation).get();

std::string instance_id = spanner_testing::RandomInstanceName(generator_);
Instance in(ProjectId(), instance_id);
ASSERT_FALSE(in.project_id().empty());
ASSERT_FALSE(in.instance_id().empty());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: remove?

I see that the above test does the same thing, but RandomInstanceName is never going to return an empty instance the way ProjectId() or InstanceId() might.

Comment on lines +244 to +246
auto instance_config =
client_.CreateInstanceConfig(ExperimentalTag{}, *operation).get();
EXPECT_THAT(instance_config, StatusIs(StatusCode::kInvalidArgument));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This confused me initially. Maybe a comment like:

// Verify that the client rejects LROs with the wrong metadata type.

Comment on lines 250 to 251
EXPECT_THAT(instance->name(), Eq(in.FullName()));
EXPECT_EQ(instance->display_name(), "test-display-name");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: local consistency of these?

This file seems to prefer EXPECT_EQ

Comment on lines 294 to 295
EXPECT_THAT(instance->name(), Eq(in.FullName()));
EXPECT_EQ(instance->display_name(), "test-display-name");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

std::string instance_id = spanner_testing::RandomInstanceName(generator_);
Instance in(ProjectId(), instance_id);
ASSERT_FALSE(in.project_id().empty());
ASSERT_FALSE(in.instance_id().empty());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same nit about deleting.

@scotthart scotthart force-pushed the generator_await_integeration_tests branch from 576ecbe to d056181 Compare June 27, 2024 15:17
Copy link
Member Author

@scotthart scotthart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 7 unresolved discussions (waiting on @dbolduc)


google/cloud/compute/integration_tests/compute_integration_test.cc line 94 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

nit (predates this PR): using ::google::cloud::testing_util::IsOk()

Fixed throughout the file.


google/cloud/compute/integration_tests/compute_integration_test.cc line 102 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

Why the string serializing/parsing?

  auto operation = client.InsertDisk(ExperimentalTag{}, NoAwaitTag{},
                                        project_id_, zone_, disk);
  ASSERT_THAT(operation, IsOk());
  auto result = client.InsertDisk(ExperimentalTag{}, *operation).get();

Added comment to explain.


google/cloud/spanner/admin/integration_tests/instance_admin_integration_test.cc line 227 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

nit: remove?

I see that the above test does the same thing, but RandomInstanceName is never going to return an empty instance the way ProjectId() or InstanceId() might.

Removed


google/cloud/spanner/admin/integration_tests/instance_admin_integration_test.cc line 246 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

This confused me initially. Maybe a comment like:

// Verify that the client rejects LROs with the wrong metadata type.

Comment added.


google/cloud/spanner/admin/integration_tests/instance_admin_integration_test.cc line 251 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

nit: local consistency of these?

This file seems to prefer EXPECT_EQ

Fixed


google/cloud/spanner/admin/integration_tests/instance_admin_rest_integration_test.cc line 271 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

same nit about deleting.

Removed.


google/cloud/spanner/admin/integration_tests/instance_admin_rest_integration_test.cc line 295 at r1 (raw file):

Previously, dbolduc (Darren Bolduc) wrote…

same

Fixed

Copy link
Member

@dbolduc dbolduc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 7 unresolved discussions (waiting on @scotthart)


google/cloud/compute/integration_tests/compute_integration_test.cc line 102 at r1 (raw file):

Previously, scotthart (Scott Hart) wrote…

Added comment to explain.

Ah. It feels like we are testing protobuf, but that is fine.

@scotthart scotthart merged commit 8d01ae3 into googleapis:main Jun 27, 2024
66 of 67 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants