-
Notifications
You must be signed in to change notification settings - Fork 11
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
Create Flink SQL gateway mock for component tests #34
Comments
i'd like to do some work on this issue. and this is what i thought: plan 1. find some python package, which runs as flink standalone & sql-gw. plan 2. use a httpretty as a mock sql-gw, plus a sqlite(in memory) mock sql operation initial design is:
catalog & database sql like: other sql on tables will be pass to sqlite and execute |
For this task I would go for something much simpler. Just use standard mock in place of a Flink SQL client (alternativly http mock) so we can do some tests like:
I would not use any sql db in place for Flink as DBs works vastly different than it. For full E2E I would use testcontainers and run actual Flink instance. So in the end we should have three layers of tests:
|
that's sensible. |
is something like this def test_tmp(self):
session = MockFlinkSqlGatewayClient.create_session(
host="127.0.0.1",
port=8083,
session_name="some_session",
)
cursor = FlinkCursor(session)
sql = "select * /** fetch_max(10) fetch_mode('streaming') fetch_timeout_ms(5000) */ from input2"
cursor.execute(sql)
# check sql received
stats = MockFlinkSqlGatewayClient.all_statements(session)
self.assertTrue("SET 'execution.runtime-mode' = 'batch'", stats[0])
self.assertTrue(sql, stats[1]) |
Yes, I just wonder about naming and function calls. Because |
We should have mock for SQL Gateway (ether mock client or provide web server mock) with utility methods so we can create component tests.
It would be worth considering to have functionality that would allow us to simply switch from mock to real instance so maybe with some simple tags we could have mixed component tests with mock and e2e test with real instance.
The text was updated successfully, but these errors were encountered: