-
Notifications
You must be signed in to change notification settings - Fork 373
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
Conversation
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.
Codecov ReportPatch coverage:
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
☔ View full report in Codecov by Sentry. |
Here is the summary of changes. You are about to add 3 region tags.
This comment is generated by snippet-bot.
|
google::cloud::spanner_testing::LogUpdateDatabaseDdl( //! TODO(#4758) | ||
client, database, metadata.status()); //! TODO(#4758) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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).
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); | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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>>
.
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