-
Notifications
You must be signed in to change notification settings - Fork 0
Enable mock test #42
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
Enable mock test #42
Conversation
b375245 to
b58ed06
Compare
b58ed06 to
063ea7b
Compare
So the tests can be skipped when `TEST_CONNECT_STR` is not set.
bfd235d to
757c956
Compare
Wrap usage of TEST_CONNECT_STR where possible
757c956 to
7b6f874
Compare
|
|
||
| EXPECT_GT(message_length, 200); |
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 error message from mock server is only 129 characters, so I adjusted this check
c66594d to
3c1c14d
Compare
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.
We want to enable builds on clang64 and MinGW too. The driver should work on any Win32 platform
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.
We need to use this to indicate where we're getting the function when using TYPED_TEST
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.
This is based on code at cpp/src/arrow/flight/test_auth_handlers.h
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 ServerAuthHandler is sort of deprecated. This was for an older implementation of stateful authentication in Flight.
We should instead use a Server middleware to authenticate the token. That would intercept the headers and let you view the token header. This should run with every request (as it is stateless authentication). There might be one already written 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.
I didn't find an existing server that takes in a token as authentication but I did find middleware that does a username/password authentication check first, and then does a header token check (cpp/src/arrow/flight/flight_test.cc#L931-L932). Based on this, I wrote the mock server middleware to do just 1 layer of token check
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.
Mock server setup and teardown is based on cpp/src/arrow/flight/sql/server_test.cc
493b2c3 to
2620adf
Compare
2620adf to
c990015
Compare
Use constant string for token
* Add todo for noauth validation * mock server with token auth Add tests * run same test with both modes * Enable ODBC tests in workflow * Switch current test cases to use FlightSQLODBCTestBase So the tests can be skipped when `TEST_CONNECT_STR` is not set. * Change tests to run on both mock and remote modes Wrap usage of TEST_CONNECT_STR where possible * Rename test fixtures and make connection string functions virtual * Fix lint issue * Attempt to enable ODBC build on Windows platforms * Attempt to fix clang64 and MinGW errors * Attempt to register ODBC * Address James' comments Use constant string for token * use ServerMiddleware to validate token
* Add todo for noauth validation * mock server with token auth Add tests * run same test with both modes * Enable ODBC tests in workflow * Switch current test cases to use FlightSQLODBCTestBase So the tests can be skipped when `TEST_CONNECT_STR` is not set. * Change tests to run on both mock and remote modes Wrap usage of TEST_CONNECT_STR where possible * Rename test fixtures and make connection string functions virtual * Fix lint issue * Attempt to enable ODBC build on Windows platforms * Attempt to fix clang64 and MinGW errors * Attempt to register ODBC * Address James' comments Use constant string for token * use ServerMiddleware to validate token
* Add todo for noauth validation * mock server with token auth Add tests * run same test with both modes * Enable ODBC tests in workflow * Switch current test cases to use FlightSQLODBCTestBase So the tests can be skipped when `TEST_CONNECT_STR` is not set. * Change tests to run on both mock and remote modes Wrap usage of TEST_CONNECT_STR where possible * Rename test fixtures and make connection string functions virtual * Fix lint issue * Attempt to enable ODBC build on Windows platforms * Attempt to fix clang64 and MinGW errors * Attempt to register ODBC * Address James' comments Use constant string for token * use ServerMiddleware to validate token
* Add todo for noauth validation * mock server with token auth Add tests * run same test with both modes * Enable ODBC tests in workflow * Switch current test cases to use FlightSQLODBCTestBase So the tests can be skipped when `TEST_CONNECT_STR` is not set. * Change tests to run on both mock and remote modes Wrap usage of TEST_CONNECT_STR where possible * Rename test fixtures and make connection string functions virtual * Fix lint issue * Attempt to enable ODBC build on Windows platforms * Attempt to fix clang64 and MinGW errors * Attempt to register ODBC * Address James' comments Use constant string for token * use ServerMiddleware to validate token
* Add todo for noauth validation * mock server with token auth Add tests * run same test with both modes * Enable ODBC tests in workflow * Switch current test cases to use FlightSQLODBCTestBase So the tests can be skipped when `TEST_CONNECT_STR` is not set. * Change tests to run on both mock and remote modes Wrap usage of TEST_CONNECT_STR where possible * Rename test fixtures and make connection string functions virtual * Fix lint issue * Attempt to enable ODBC build on Windows platforms * Attempt to fix clang64 and MinGW errors * Attempt to register ODBC * Address James' comments Use constant string for token * use ServerMiddleware to validate token
* Add todo for noauth validation * mock server with token auth Add tests * run same test with both modes * Enable ODBC tests in workflow * Switch current test cases to use FlightSQLODBCTestBase So the tests can be skipped when `TEST_CONNECT_STR` is not set. * Change tests to run on both mock and remote modes Wrap usage of TEST_CONNECT_STR where possible * Rename test fixtures and make connection string functions virtual * Fix lint issue * Attempt to enable ODBC build on Windows platforms * Attempt to fix clang64 and MinGW errors * Attempt to register ODBC * Address James' comments Use constant string for token * use ServerMiddleware to validate token
Enable mock test.
Goal:
Inside the mock tests (that use
FlightSQLODBCMockTestBase), a mock in-memory SQLite server atlocalhost:<port>is set up before every test case and teardown afterwards.<port>is any available port. Theportvalue is saved to get the connection string for the mock server.graph TD; A[FlightSQLODBCTestBase]-->B[FlightSQLODBCMockTestBase]; A-->C[FlightSQLODBCRemoteTestBase];If we want a test to be run with remote server, use
TEST_F(FlightSQLODBCRemoteTestBase, <TestName>). In general, tests that run with mock server should also be runnable with remote server.If environment variable
ARROW_FLIGHT_SQL_ODBC_CONNis not set, the remote server tests are automatically skipped. This makes running tests with only mock server easier.