-
Notifications
You must be signed in to change notification settings - Fork 436
impl(spanner): add interval integration tests #15118
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(spanner): add interval integration tests #15118
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #15118 +/- ##
==========================================
- Coverage 92.92% 92.91% -0.01%
==========================================
Files 2389 2389
Lines 214832 214870 +38
==========================================
+ Hits 199631 199647 +16
- Misses 15201 15223 +22 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| EXPECT_THAT(result, IsOkAndHolds(UnorderedElementsAreArray(data))); | ||
| } | ||
|
|
||
| TEST_F(DataTypeIntegrationTest, SelectIntervalScalar) { |
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.
Integration tests for a new Spanner type should include an addition to the DataTypes table in testing/database_integration_test.cc, and "WriteRead{,Array}" test cases in this file to exercise the new column.
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.
For reasons I am not privy to, the Interval data type cannot be used as a column in a table.
| EXPECT_THAT(result, IsOkAndHolds(UnorderedElementsAreArray(data))); | ||
| } | ||
|
|
||
| TEST_F(DataTypeIntegrationTest, SelectIntervalScalar) { |
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.
Integration tests for a new Spanner type should include additions to MutationsTests.SpannerTypes in mutations_test.cc.
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.
As I understand it, mutations can only be performed on table columns.
| } | ||
|
|
||
| TEST_F(DataTypeIntegrationTest, SelectIntervalScalar) { | ||
| if (UsingEmulator()) GTEST_SKIP(); |
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.
The Spanner integrations tests have been written to expect particular behavior from the emulator, even it is an error, rather than just skipping the test altogether. See all the other UsingEmulator() calls in this file, for example. This allows us to learn when the emulator changes behavior and react accordingly, rather than just forgetting about the whole issue forever more.
[It also helped the emulator team, who (at least previously) ran our tests to check their implementation. Rather than just seeing successes no matter what they did, expecting the old (error) behavior allowed them to verify that things had indeed changed, and also to compare their new behavior to that of the service.]
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.
created #15162
| std::chrono::hours(1))}; | ||
| std::time_t now_seconds = | ||
| std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); | ||
| std::time_t one_hour_later_seconds = now_seconds + 3600; |
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.
Do chrono arithmetic in the chrono domain.
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.
created #15163
scotthart
left a comment
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.
Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions
| EXPECT_THAT(result, IsOkAndHolds(UnorderedElementsAreArray(data))); | ||
| } | ||
|
|
||
| TEST_F(DataTypeIntegrationTest, SelectIntervalScalar) { |
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.
For reasons I am not privy to, the Interval data type cannot be used as a column in a table.
| EXPECT_THAT(result, IsOkAndHolds(UnorderedElementsAreArray(data))); | ||
| } | ||
|
|
||
| TEST_F(DataTypeIntegrationTest, SelectIntervalScalar) { |
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.
As I understand it, mutations can only be performed on table columns.
| } | ||
|
|
||
| TEST_F(DataTypeIntegrationTest, SelectIntervalScalar) { | ||
| if (UsingEmulator()) GTEST_SKIP(); |
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.
created #15162
| std::chrono::hours(1))}; | ||
| std::time_t now_seconds = | ||
| std::chrono::system_clock::to_time_t(std::chrono::system_clock::now()); | ||
| std::time_t one_hour_later_seconds = now_seconds + 3600; |
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.
created #15163
This change is