-
Notifications
You must be signed in to change notification settings - Fork 3.9k
GH-47786: [C++][FlightRPC] Establish ODBC tests #47788
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
Conversation
|
|
| // TODO: once RegisterDsn is implemented in Mac and Linux, the following can be | ||
| // re-enabled. | ||
| #if defined _WIN32 || defined _WIN64 | ||
| bool WriteDSN(std::string connection_str) { |
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.
Could you please raise a GitHub issue for this todo?
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.
|
|
||
| void FlightSQLODBCRemoteTestBase::SetUp() { | ||
| if (arrow::internal::GetEnvVar(TEST_CONNECT_STR).ValueOr("").empty()) { | ||
| GTEST_SKIP() << "Skipping FlightSQLODBCRemoteTestBase test: TEST_CONNECT_STR not set"; |
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.
Can we change to use arrow log for this?
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.
LGTM
| template <typename T> | ||
| class FlightSQLODBCTestBase : public T { | ||
| public: | ||
| using List = std::list<T>; | ||
| }; | ||
|
|
||
| using TestTypes = | ||
| ::testing::Types<FlightSQLODBCMockTestBase, FlightSQLODBCRemoteTestBase>; | ||
| TYPED_TEST_SUITE(FlightSQLODBCTestBase, TestTypes); |
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.
Why is the parametrization so complex here? Subclassing a type parameter looks suspicious...Is the idea to test with a mocked server and an in process server?
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 mentioned in the other PR I would prefer we don't scatter tests using this fixture across different files. So instead of having FlightSQLODBCTestBase defined here I would rather we have proper docstrings for FlightSQLODBCMockTestBase and FlightSQLODBCRemoteTestBase that explain what they're for and how you're expected to parametrize them, and define the equivalent of FlightSQLODBCTestBase in individual test files where necessary.
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 parametrization, we followed Google's instruction for creating typed tests (https://google.github.io/googletest/advanced.html#typed-tests), and their example used using List = std::list<T>; etc.
Is the idea to test with a mocked server and an in process server?
Yes that is right. For majority of ODBC tests, we want to run the tests on both a local mock server and a remote server. I agree that FlightSQLODBCTestBase can be removed cc @justing-bq.
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.
their example used
using List = std::list<T>
Um, but do you need to use that? If not, please remove it. It's not required.
Note the justification for typed tests:
Suppose you have multiple implementations of the same interface and want to make sure that all of them satisfy some common requirements. Or, you may have defined several types that are supposed to conform to the same “concept” and you want to verify it. In both cases, you want the same test logic repeated for different types.
While it's not like you can't use the mechanism in other ways, it's a little surprising to see it used in this way.
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.
FlightSQLODBCTestBase is now removed. Future PRs will be adding separate equivalent text fixtures for each file.
36903c7 to
1653d29
Compare
| }; | ||
|
|
||
| /** ODBC read buffer size. */ | ||
| constexpr int ODBC_BUFFER_SIZE = 1024; |
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.
| constexpr int ODBC_BUFFER_SIZE = 1024; | |
| static constexpr int kOdbcBufferSize = 1024; |
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.
Done.
| #define TEST_CONNECT_STR "ARROW_FLIGHT_SQL_ODBC_CONN" | ||
| #define TEST_DSN "Apache Arrow Flight SQL Test DSN" |
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.
While we're at it, these could be static constexpr std::string_view (maybe that's inconvenient though)
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.
Done.
Co-Authored-By: rscales <[email protected]> Co-Authored-By: justing-bq <[email protected]> Co-Authored-By: alinalibq <[email protected]>
|
After merging your PR, Conbench analyzed the 4 benchmarking runs that have been run so far on merge-commit 0a0ee3e. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. |
Rationale for this change
#47786
What changes are included in this PR?
Created a new directory/subproject for tests.
Added a testing utility class called
odbc_test_suite.Created new test file with one simple test.
Are these changes tested?
Yes
Are there any user-facing changes?
No