Skip to content

Commit 6894b4c

Browse files
remove redundant tests (temp)
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 57ebf06 commit 6894b4c

File tree

2 files changed

+1
-207
lines changed

2 files changed

+1
-207
lines changed

src/databricks/sql/backend/sea/queue.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def __init__(
153153
self._shutdown_event = threading.Event()
154154

155155
self._link_present = threading.Condition()
156-
self._error = None
156+
self._error: Optional[Exception] = None
157157
self.chunk_index_to_link: Dict[int, "ExternalLink"] = {}
158158

159159
for link in initial_links:

tests/unit/test_sea_queue.py

Lines changed: 0 additions & 206 deletions
Original file line numberDiff line numberDiff line change
@@ -296,79 +296,6 @@ def sample_external_link_no_headers(self):
296296
http_headers=None,
297297
)
298298

299-
def test_convert_to_thrift_link(self, sample_external_link):
300-
"""Test conversion of ExternalLink to TSparkArrowResultLink."""
301-
queue = Mock(spec=SeaCloudFetchQueue)
302-
303-
# Call the method directly
304-
result = SeaCloudFetchQueue._convert_to_thrift_link(queue, sample_external_link)
305-
306-
# Verify the conversion
307-
assert result.fileLink == sample_external_link.external_link
308-
assert result.rowCount == sample_external_link.row_count
309-
assert result.bytesNum == sample_external_link.byte_count
310-
assert result.startRowOffset == sample_external_link.row_offset
311-
assert result.httpHeaders == sample_external_link.http_headers
312-
313-
def test_convert_to_thrift_link_no_headers(self, sample_external_link_no_headers):
314-
"""Test conversion of ExternalLink with no headers to TSparkArrowResultLink."""
315-
queue = Mock(spec=SeaCloudFetchQueue)
316-
317-
# Call the method directly
318-
result = SeaCloudFetchQueue._convert_to_thrift_link(
319-
queue, sample_external_link_no_headers
320-
)
321-
322-
# Verify the conversion
323-
assert result.fileLink == sample_external_link_no_headers.external_link
324-
assert result.rowCount == sample_external_link_no_headers.row_count
325-
assert result.bytesNum == sample_external_link_no_headers.byte_count
326-
assert result.startRowOffset == sample_external_link_no_headers.row_offset
327-
assert result.httpHeaders == {}
328-
329-
@patch("databricks.sql.backend.sea.queue.ResultFileDownloadManager")
330-
@patch("databricks.sql.backend.sea.queue.logger")
331-
def test_init_with_valid_initial_link(
332-
self,
333-
mock_logger,
334-
mock_download_manager_class,
335-
mock_sea_client,
336-
ssl_options,
337-
description,
338-
sample_external_link,
339-
):
340-
"""Test initialization with valid initial link."""
341-
mock_download_manager = Mock()
342-
mock_download_manager_class.return_value = mock_download_manager
343-
344-
# Create a queue with valid initial link
345-
with patch.object(SeaCloudFetchQueue, "_create_next_table", return_value=None):
346-
queue = SeaCloudFetchQueue(
347-
initial_links=[sample_external_link],
348-
max_download_threads=5,
349-
ssl_options=ssl_options,
350-
sea_client=mock_sea_client,
351-
statement_id="test-statement-123",
352-
total_chunk_count=1,
353-
lz4_compressed=False,
354-
description=description,
355-
)
356-
357-
# Verify debug message was logged
358-
mock_logger.debug.assert_called_with(
359-
"SeaCloudFetchQueue: Initialize CloudFetch loader for statement {}, total chunks: {}".format(
360-
"test-statement-123", 1
361-
)
362-
)
363-
364-
# Verify download manager was created
365-
mock_download_manager_class.assert_called_once()
366-
367-
# Verify attributes
368-
assert queue._statement_id == "test-statement-123"
369-
assert queue._current_chunk_link == sample_external_link
370-
assert queue.download_manager == mock_download_manager
371-
372299
@patch("databricks.sql.backend.sea.queue.ResultFileDownloadManager")
373300
@patch("databricks.sql.backend.sea.queue.logger")
374301
def test_init_no_initial_links(
@@ -408,136 +335,3 @@ def test_init_no_initial_links(
408335
not hasattr(queue, "_current_chunk_link")
409336
or queue._current_chunk_link is None
410337
)
411-
412-
@patch("databricks.sql.backend.sea.queue.ResultFileDownloadManager")
413-
@patch("databricks.sql.backend.sea.queue.logger")
414-
def test_init_non_zero_chunk_index(
415-
self,
416-
mock_logger,
417-
mock_download_manager_class,
418-
mock_sea_client,
419-
ssl_options,
420-
description,
421-
):
422-
"""Test initialization with non-zero chunk index initial link."""
423-
# Create a link with chunk_index != 0
424-
non_zero_link = ExternalLink(
425-
external_link="https://example.com/data/chunk1",
426-
expiration="2025-07-03T05:51:18.118009",
427-
row_count=100,
428-
byte_count=1024,
429-
row_offset=100,
430-
chunk_index=1,
431-
next_chunk_index=2,
432-
http_headers={"Authorization": "Bearer token123"},
433-
)
434-
435-
# Create a queue with non-zero chunk index
436-
queue = SeaCloudFetchQueue(
437-
initial_links=[non_zero_link],
438-
max_download_threads=5,
439-
ssl_options=ssl_options,
440-
sea_client=mock_sea_client,
441-
statement_id="test-statement-123",
442-
total_chunk_count=1,
443-
lz4_compressed=False,
444-
description=description,
445-
)
446-
447-
# Verify debug message was logged
448-
mock_logger.debug.assert_called_with(
449-
"SeaCloudFetchQueue: Initialize CloudFetch loader for statement {}, total chunks: {}".format(
450-
"test-statement-123", 1
451-
)
452-
)
453-
454-
# Verify download manager wasn't created (no chunk 0)
455-
mock_download_manager_class.assert_not_called()
456-
457-
@patch("databricks.sql.backend.sea.queue.logger")
458-
def test_progress_chunk_link_no_current_link(self, mock_logger):
459-
"""Test _progress_chunk_link with no current link."""
460-
# Create a queue instance without initializing
461-
queue = Mock(spec=SeaCloudFetchQueue)
462-
queue._current_chunk_link = None
463-
464-
# Call the method directly
465-
result = SeaCloudFetchQueue._progress_chunk_link(queue)
466-
467-
# Verify the result is None
468-
assert result is None
469-
470-
@patch("databricks.sql.backend.sea.queue.logger")
471-
def test_progress_chunk_link_no_next_chunk(self, mock_logger):
472-
"""Test _progress_chunk_link with no next chunk index."""
473-
# Create a queue instance without initializing
474-
queue = Mock(spec=SeaCloudFetchQueue)
475-
queue._current_chunk_link = ExternalLink(
476-
external_link="https://example.com/data/chunk0",
477-
expiration="2025-07-03T05:51:18.118009",
478-
row_count=100,
479-
byte_count=1024,
480-
row_offset=0,
481-
chunk_index=0,
482-
next_chunk_index=None,
483-
http_headers={"Authorization": "Bearer token123"},
484-
)
485-
486-
# Call the method directly
487-
result = SeaCloudFetchQueue._progress_chunk_link(queue)
488-
489-
# Verify the result is None
490-
assert result is None
491-
assert queue._current_chunk_link is None
492-
493-
@patch("databricks.sql.backend.sea.queue.logger")
494-
def test_create_next_table_no_current_link(self, mock_logger):
495-
"""Test _create_next_table with no current link."""
496-
# Create a queue instance without initializing
497-
queue = Mock(spec=SeaCloudFetchQueue)
498-
queue._current_chunk_link = None
499-
500-
# Call the method directly
501-
result = SeaCloudFetchQueue._create_next_table(queue)
502-
503-
# Verify debug message was logged
504-
mock_logger.debug.assert_called_with(
505-
"SeaCloudFetchQueue: No current chunk link, returning"
506-
)
507-
508-
# Verify the result is None
509-
assert result is None
510-
511-
@patch("databricks.sql.backend.sea.queue.logger")
512-
def test_create_next_table_success(self, mock_logger):
513-
"""Test _create_next_table with successful table creation."""
514-
# Create a queue instance without initializing
515-
queue = Mock(spec=SeaCloudFetchQueue)
516-
queue._current_chunk_link = ExternalLink(
517-
external_link="https://example.com/data/chunk0",
518-
expiration="2025-07-03T05:51:18.118009",
519-
row_count=100,
520-
byte_count=1024,
521-
row_offset=50,
522-
chunk_index=0,
523-
next_chunk_index=1,
524-
http_headers={"Authorization": "Bearer token123"},
525-
)
526-
queue.download_manager = Mock()
527-
528-
# Mock the dependencies
529-
mock_table = Mock()
530-
queue._create_table_at_offset = Mock(return_value=mock_table)
531-
queue._progress_chunk_link = Mock()
532-
533-
# Call the method directly
534-
result = SeaCloudFetchQueue._create_next_table(queue)
535-
536-
# Verify the table was created
537-
queue._create_table_at_offset.assert_called_once_with(50)
538-
539-
# Verify progress was called
540-
queue._progress_chunk_link.assert_called_once()
541-
542-
# Verify the result is the table
543-
assert result == mock_table

0 commit comments

Comments
 (0)