-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-46575: [C++][FlightRPC] Add Diagnostic tests #47764
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
|
|
||
| namespace arrow::flight::sql::odbc { | ||
|
|
||
| TYPED_TEST(FlightSQLODBCTestBase, TestSQLGetDiagFieldWForConnectFailure) { |
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.
Same comment here, we can subclass the base fixture and create a specific fixture for this file.
| // Allocate an environment handle | ||
| SQLRETURN ret = SQLAllocEnv(&env); | ||
|
|
||
| EXPECT_EQ(SQL_SUCCESS, ret); |
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 test will continue even if EXPECT_ fails. Usually these kinds of checks should be ASSERT.
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.
It would be more concise to just ASSERT_EQ(SQL_SUCCESS, SQLAllocEnv(&env)) and so on.
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.
yup, updated the code to use ASSERT_EQ
| // Test is disabled because driver manager on Windows does not pass through SQL_NTS | ||
| // This test case can be potentially used on macOS/Linux | ||
| 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.
If the test name starts with DISABLED_, GTest will ignore the test automatically
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.
changed to use DISABLED_ and removed GTEST_SKIP
19da64d to
4f4bbc0
Compare
alinaliBQ
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.
In-progress of addressing comments. The team is still working on improving the subclass logic for separate test fixture (discussion is in #47788)
| // Allocate an environment handle | ||
| SQLRETURN ret = SQLAllocEnv(&env); | ||
|
|
||
| EXPECT_EQ(SQL_SUCCESS, ret); |
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.
yup, updated the code to use ASSERT_EQ
| // Test is disabled because driver manager on Windows does not pass through SQL_NTS | ||
| // This test case can be potentially used on macOS/Linux | ||
| 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.
changed to use DISABLED_ and removed GTEST_SKIP
| public: | ||
| using List = std::list<T>; |
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.
| public: | |
| using List = std::list<T>; |
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, removed using List
| template <typename T> | ||
| class ErrorsOdbcV2Test : public T { | ||
| public: | ||
| using List = std::list<T>; | ||
| }; |
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.
| template <typename T> | |
| class ErrorsOdbcV2Test : public T { | |
| public: | |
| using List = std::list<T>; | |
| }; | |
| template <typename T> | |
| class ErrorsOdbcV2Test : public T { | |
| }; |
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.
fixed
| // Free connection handle | ||
| EXPECT_EQ(SQL_SUCCESS, SQLFreeHandle(SQL_HANDLE_DBC, conn)); |
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.
maybe consider an RAII helper to free resources in tests
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.
Added RAII helper for this (ErrorsHandleTest)
| // API not implemented error from driver manager | ||
| EXPECT_EQ(std::wstring(L"IM001"), std::wstring(sql_state)); | ||
|
|
||
| EXPECT_TRUE(!std::wstring(message).empty()); |
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.
EXPECT_FALSE?
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.
Yup good catch, fixed
4f4bbc0 to
99d8ec6
Compare
99d8ec6 to
eddea34
Compare
alinaliBQ
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.
Addressed comments
| public: | ||
| using List = std::list<T>; |
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, removed using List
| template <typename T> | ||
| class ErrorsOdbcV2Test : public T { | ||
| public: | ||
| using List = std::list<T>; | ||
| }; |
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.
fixed
| // Free connection handle | ||
| EXPECT_EQ(SQL_SUCCESS, SQLFreeHandle(SQL_HANDLE_DBC, conn)); |
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.
Added RAII helper for this (ErrorsHandleTest)
| // API not implemented error from driver manager | ||
| EXPECT_EQ(std::wstring(L"IM001"), std::wstring(sql_state)); | ||
|
|
||
| EXPECT_TRUE(!std::wstring(message).empty()); |
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.
Yup good catch, fixed
| static constexpr std::string_view authorization_header = "authorization"; | ||
| static constexpr std::string_view bearer_prefix = "Bearer "; | ||
| static constexpr std::string_view test_token = "t0k3n"; |
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 keep to the naming scheme? kAuthorizationHeader etc.
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.
eddea34 to
2768502
Compare
### Rationale for this change ODBC needs to provide diagnostic information so users can debug the error ### What changes are included in this PR? - Implementation of SQLGetDiagField and SQLGetDiagRec Tests are included in separate PR (see #47764) ### Are these changes tested? Tests will be in a separate PR (see #47764). Other APIs depend on SQLGetDiagField and SQLGetDiagRec to get error reporting functionality, and tests for SQLGetDiagField and SQLGetDiagRec depend on other APIs for creating errors, as these diagnostic APIs alone do not initiate any errors. Changes tested locally ### Are there any user-facing changes? No * GitHub Issue: #46575 Authored-by: Alina (Xi) Li <[email protected]> Signed-off-by: Sutou Kouhei <[email protected]>
2768502 to
d808e34
Compare
3bdd474 to
fdaf290
Compare
fdaf290 to
34546b5
Compare
Requires SQLDriverConnect Implementation Co-authored-by: rscales <[email protected]>
34546b5 to
9a1ebf4
Compare
|
@jduo Could you use our merge script https://github.com/apache/arrow/tree/main/dev#how-to-merge-a-pull-request in this repository? |
Sure @kou . Do you mean to re-do the last two merges using the scripts or use the merge script going forward? Thanks |
|
The latter. (We can't re-do merges in public repositories because it changes commit hashes...) |
|
After merging your PR, Conbench analyzed the 3 benchmarking runs that have been run so far on merge-commit 6fed4f3. There were no benchmark performance regressions. 🎉 The full Conbench report has more details. It also includes information about 1 possible false positive for unstable benchmarks that are known to sometimes produce them. |
Rationale for this change
Putting the tests for diagnostics in a separate PR from #47763, because non-diagnostic ODBC APIs are required to get diagnostics.
What changes are included in this PR?
Are these changes tested?
PR depends on #47971 for tests to work.
Tested locally.
Are there any user-facing changes?
No