Skip to content

Commit b5578ca

Browse files
remove redundant tests
Signed-off-by: varun-edachali-dbx <[email protected]>
1 parent 9cf6e02 commit b5578ca

File tree

2 files changed

+0
-153
lines changed

2 files changed

+0
-153
lines changed

tests/unit/test_sea_backend.py

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -890,76 +890,3 @@ def test_get_columns(self, sea_client, sea_session_id, mock_cursor):
890890
cursor=mock_cursor,
891891
)
892892
assert "Catalog name is required for get_columns" in str(excinfo.value)
893-
894-
def test_get_chunk_link(self, sea_client, mock_http_client, sea_command_id):
895-
"""Test get_chunk_link method."""
896-
# Setup mock response
897-
mock_response = {
898-
"external_links": [
899-
{
900-
"external_link": "https://example.com/data/chunk0",
901-
"expiration": "2025-07-03T05:51:18.118009",
902-
"row_count": 100,
903-
"byte_count": 1024,
904-
"row_offset": 0,
905-
"chunk_index": 0,
906-
"next_chunk_index": 1,
907-
"http_headers": {"Authorization": "Bearer token123"},
908-
}
909-
]
910-
}
911-
mock_http_client._make_request.return_value = mock_response
912-
913-
# Call the method
914-
result = sea_client.get_chunk_link("test-statement-123", 0)
915-
916-
# Verify the HTTP client was called correctly
917-
mock_http_client._make_request.assert_called_once_with(
918-
method="GET",
919-
path=sea_client.CHUNK_PATH_WITH_ID_AND_INDEX.format(
920-
"test-statement-123", 0
921-
),
922-
)
923-
924-
# Verify the result
925-
assert result.external_link == "https://example.com/data/chunk0"
926-
assert result.expiration == "2025-07-03T05:51:18.118009"
927-
assert result.row_count == 100
928-
assert result.byte_count == 1024
929-
assert result.row_offset == 0
930-
assert result.chunk_index == 0
931-
assert result.next_chunk_index == 1
932-
assert result.http_headers == {"Authorization": "Bearer token123"}
933-
934-
def test_get_chunk_link_not_found(self, sea_client, mock_http_client):
935-
"""Test get_chunk_link when the requested chunk is not found."""
936-
# Setup mock response with no matching chunk
937-
mock_response = {
938-
"external_links": [
939-
{
940-
"external_link": "https://example.com/data/chunk1",
941-
"expiration": "2025-07-03T05:51:18.118009",
942-
"row_count": 100,
943-
"byte_count": 1024,
944-
"row_offset": 100,
945-
"chunk_index": 1, # Different chunk index
946-
"next_chunk_index": 2,
947-
"http_headers": {"Authorization": "Bearer token123"},
948-
}
949-
]
950-
}
951-
mock_http_client._make_request.return_value = mock_response
952-
953-
# Call the method and expect an exception
954-
with pytest.raises(
955-
ServerOperationError, match="No link found for chunk index 0"
956-
):
957-
sea_client.get_chunk_link("test-statement-123", 0)
958-
959-
# Verify the HTTP client was called correctly
960-
mock_http_client._make_request.assert_called_once_with(
961-
method="GET",
962-
path=sea_client.CHUNK_PATH_WITH_ID_AND_INDEX.format(
963-
"test-statement-123", 0
964-
),
965-
)

tests/unit/test_sea_queue.py

Lines changed: 0 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -490,86 +490,6 @@ def test_progress_chunk_link_no_next_chunk(self, mock_logger):
490490
assert result is None
491491
assert queue._current_chunk_link is None
492492

493-
@patch("databricks.sql.backend.sea.queue.logger")
494-
def test_progress_chunk_link_success(self, mock_logger, mock_sea_client):
495-
"""Test _progress_chunk_link with successful progression."""
496-
# Create a queue instance without initializing
497-
queue = Mock(spec=SeaCloudFetchQueue)
498-
queue._current_chunk_link = ExternalLink(
499-
external_link="https://example.com/data/chunk0",
500-
expiration="2025-07-03T05:51:18.118009",
501-
row_count=100,
502-
byte_count=1024,
503-
row_offset=0,
504-
chunk_index=0,
505-
next_chunk_index=1,
506-
http_headers={"Authorization": "Bearer token123"},
507-
)
508-
queue._sea_client = mock_sea_client
509-
queue._statement_id = "test-statement-123"
510-
511-
# Setup the mock client to return a new link
512-
next_link = ExternalLink(
513-
external_link="https://example.com/data/chunk1",
514-
expiration="2025-07-03T05:51:18.235843",
515-
row_count=50,
516-
byte_count=512,
517-
row_offset=100,
518-
chunk_index=1,
519-
next_chunk_index=None,
520-
http_headers={"Authorization": "Bearer token123"},
521-
)
522-
mock_sea_client.get_chunk_link.return_value = next_link
523-
524-
# Call the method directly
525-
SeaCloudFetchQueue._progress_chunk_link(queue)
526-
527-
# Verify the client was called
528-
mock_sea_client.get_chunk_link.assert_called_once_with("test-statement-123", 1)
529-
530-
# Verify debug message was logged
531-
mock_logger.debug.assert_called_with(
532-
f"SeaCloudFetchQueue: Progressed to link for chunk 1: {next_link}"
533-
)
534-
535-
@patch("databricks.sql.backend.sea.queue.logger")
536-
def test_progress_chunk_link_error(self, mock_logger, mock_sea_client):
537-
"""Test _progress_chunk_link with error during chunk fetch."""
538-
# Create a queue instance without initializing
539-
queue = Mock(spec=SeaCloudFetchQueue)
540-
queue._current_chunk_link = ExternalLink(
541-
external_link="https://example.com/data/chunk0",
542-
expiration="2025-07-03T05:51:18.118009",
543-
row_count=100,
544-
byte_count=1024,
545-
row_offset=0,
546-
chunk_index=0,
547-
next_chunk_index=1,
548-
http_headers={"Authorization": "Bearer token123"},
549-
)
550-
queue._sea_client = mock_sea_client
551-
queue._statement_id = "test-statement-123"
552-
553-
# Setup the mock client to raise an error
554-
error_message = "Network error"
555-
mock_sea_client.get_chunk_link.side_effect = Exception(error_message)
556-
557-
# Call the method directly
558-
result = SeaCloudFetchQueue._progress_chunk_link(queue)
559-
560-
# Verify the client was called
561-
mock_sea_client.get_chunk_link.assert_called_once_with("test-statement-123", 1)
562-
563-
# Verify error message was logged
564-
mock_logger.error.assert_called_with(
565-
"SeaCloudFetchQueue: Error fetching link for chunk {}: {}".format(
566-
1, error_message
567-
)
568-
)
569-
570-
# Verify the result is None
571-
assert result is None
572-
573493
@patch("databricks.sql.backend.sea.queue.logger")
574494
def test_create_next_table_no_current_link(self, mock_logger):
575495
"""Test _create_next_table with no current link."""

0 commit comments

Comments
 (0)