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

feat(spanner): tests and samples for foreign-key delete cascade #12122

Merged
merged 1 commit into from
Jul 18, 2023

Conversation

devbww
Copy link
Contributor

@devbww devbww commented Jul 17, 2023

As is often the case, the integration tests don't exercise anything that is particularly specific to the client implementation, but we adhere to the cross-language test specification none the less.


This change is Reviewable

As is often the case, the integration tests don't exercise anything
that is particularly specific to the client implementation, but we
adhere to the cross-language test specification none the less.
@devbww devbww temporarily deployed to internal July 17, 2023 21:18 — with GitHub Actions Inactive
@product-auto-label product-auto-label bot added api: spanner Issues related to the Spanner API. samples Issues that are directly related to samples. labels Jul 17, 2023
@codecov
Copy link

codecov bot commented Jul 17, 2023

Codecov Report

Patch coverage: 3.12% and project coverage change: -0.09 ⚠️

Comparison is base (92526f5) 93.68% compared to head (2cc4984) 93.60%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #12122      +/-   ##
==========================================
- Coverage   93.68%   93.60%   -0.09%     
==========================================
  Files        2012     2012              
  Lines      175729   175889     +160     
==========================================
+ Hits       164629   164638       +9     
- Misses      11100    11251     +151     
Impacted Files Coverage Δ
google/cloud/spanner/samples/samples.cc 61.04% <2.63%> (-0.84%) ⬇️
...anner/integration_tests/client_integration_test.cc 75.05% <3.27%> (-11.35%) ⬇️

... and 8 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@devbww devbww marked this pull request as ready for review July 17, 2023 22:31
@devbww devbww requested a review from a team as a code owner July 17, 2023 22:31
@snippet-bot
Copy link

snippet-bot bot commented Jul 17, 2023

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Comment on lines +3474 to +3475
google::cloud::spanner_testing::LogUpdateDatabaseDdl( //! TODO(#4758)
client, database, metadata.status()); //! TODO(#4758)
Copy link
Member

Choose a reason for hiding this comment

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

So I see that //! TODO(#4758) is used in other samples, too. I forget, are these lines excluded from the public samples?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, assuming that the docs "snippet include" widget has the appropriate exclude_regexp="//!" setting (which I've recently ensured they do).

Comment on lines +1153 to +1157
for (auto& cart : StreamOf<std::tuple<std::int64_t>>(carts)) {
EXPECT_THAT(cart, IsOk());
if (!cart) break;
EXPECT_FALSE(true) << "Unexpected cart " << std::get<0>(*cart);
}
Copy link
Member

Choose a reason for hiding this comment

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

comment: This took me a second to understand.

Something like:

EXPECT_THAT(StreamOf<std::tuple<std::int64_t>>(carts), IsEmpty());

... would set a clearer expectation, but the errors in the failure modes would be less useful. Up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, it would be more complicated than that, as StreamOf returns a "range", which would then have to be used to produce a container that could be matched against IsEmpty.

For now then, I choose to leave it as-is, if only to align with the other, similar StreamOf expectations. Perhaps we could later introduce a test helper that converts a stream to a StatusOr<vector<RowType>>.

@devbww devbww merged commit 7a0802a into googleapis:main Jul 18, 2023
@devbww devbww deleted the delete-cascade branch July 18, 2023 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the Spanner API. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants