Skip to content

Commit 0a04d94

Browse files
test(kernel): distinguish inline delivery from CloudFetch
Signed-off-by: Aakash Saravanan <aakash.saravanan@databricks.com>
1 parent eece87e commit 0a04d94

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

‎tests/e2e/test_kernel_backend.py‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,15 @@ def conn(kernel_conn_params):
137137
c.close()
138138

139139

140-
def test_cloudfetch_disabled_returns_complete_large_result(kernel_conn_params):
140+
@pytest.mark.parametrize("use_cloud_fetch", [False, True])
141+
def test_cloudfetch_disabled_returns_complete_large_result(
142+
kernel_conn_params, caplog, use_cloud_fetch
143+
):
141144
from databricks.sql.backend.kernel.client import KernelDatabricksClient
142145

143-
with sql.connect(**kernel_conn_params, use_cloud_fetch=False) as connection:
146+
with caplog.at_level(logging.INFO, logger="databricks.sql.kernel"), sql.connect(
147+
**kernel_conn_params, use_cloud_fetch=use_cloud_fetch
148+
) as connection:
144149
assert isinstance(connection.session.backend, KernelDatabricksClient)
145150
with connection.cursor() as cursor:
146151
cursor.execute(
@@ -163,6 +168,19 @@ def test_cloudfetch_disabled_returns_complete_large_result(kernel_conn_params):
163168
"a25ada4c6c476b53e97eb6e8a945e9ce4c14cc432c7ad672dc6fb607d660c86a"
164169
)
165170

171+
messages = [
172+
record.getMessage()
173+
for record in caplog.records
174+
if record.name.startswith("databricks.sql.kernel")
175+
]
176+
assert (
177+
any("Using CloudFetch reader" in message for message in messages)
178+
== use_cloud_fetch
179+
)
180+
assert any(
181+
"inline" in message.lower() and "reader" in message.lower()
182+
for message in messages
183+
) == (not use_cloud_fetch)
166184

167185
def test_connect_with_use_kernel_opens_a_session(conn):
168186
assert conn.open, "connection should report open after connect()"
@@ -394,7 +412,9 @@ def test_schemas_with_empty_string_filter_matches_nothing(conn):
394412
assert cur.fetchall() == []
395413

396414

397-
@pytest.mark.parametrize("empty_filter", ["schema_name", "table_name", "column_name"])
415+
@pytest.mark.parametrize(
416+
"empty_filter", ["schema_name", "table_name", "column_name"]
417+
)
398418
def test_columns_with_empty_string_filter_matches_nothing(conn, empty_filter):
399419
filters = {
400420
"catalog_name": "system",

0 commit comments

Comments
 (0)