Skip to content

Commit 46075f9

Browse files
committed
test
Signed-off-by: Sai Shree Pradhan <saishree.pradhan@databricks.com>
1 parent ee29b9b commit 46075f9

File tree

2 files changed

+6
-17
lines changed

2 files changed

+6
-17
lines changed

src/databricks/sql/telemetry/telemetry_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,4 +469,3 @@ def connection_failure_log(
469469
telemetry_client._user_agent = user_agent
470470

471471
telemetry_client.export_failure_log(error_name, error_message)
472-
TelemetryClientFactory.close(UNAUTH_DUMMY_SESSION_ID)

tests/unit/test_telemetry.py

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,10 @@ def test_factory_shutdown_flow(self):
290290
assert TelemetryClientFactory._initialized is False
291291
assert TelemetryClientFactory._executor is None
292292

293+
@patch("databricks.sql.telemetry.telemetry_client.TelemetryClient.export_failure_log")
293294
@patch("databricks.sql.client.Session")
294-
@patch("databricks.sql.telemetry.telemetry_client.TelemetryClient._send_telemetry")
295295
def test_connection_failure_sends_correct_telemetry_payload(
296-
self, mock_send_telemetry, mock_session
296+
self, mock_session, mock_export_failure_log
297297
):
298298
"""
299299
Verify that a connection failure constructs and sends the correct
@@ -309,17 +309,7 @@ def test_connection_failure_sends_correct_telemetry_payload(
309309
except Exception as e:
310310
assert str(e) == error_message
311311

312-
mock_send_telemetry.assert_called_once()
313-
314-
call_arguments = mock_send_telemetry.call_args.args
315-
sent_events = call_arguments[0]
316-
317-
assert len(sent_events) == 1
318-
telemetry_log = sent_events[0]
319-
320-
assert telemetry_log.entry.sql_driver_log is not None
321-
322-
error_info = telemetry_log.entry.sql_driver_log.error_info
323-
assert error_info is not None
324-
assert error_info.error_name == "Exception"
325-
assert error_info.stack_trace == error_message
312+
mock_export_failure_log.assert_called_once()
313+
call_arguments = mock_export_failure_log.call_args
314+
assert call_arguments[0][0] == "Exception"
315+
assert call_arguments[0][1] == error_message

0 commit comments

Comments
 (0)