1
1
import pyarrow
2
2
import unittest
3
3
from unittest .mock import MagicMock , patch
4
- from ssl import create_default_context
5
4
6
5
from databricks .sql .thrift_api .TCLIService .ttypes import TSparkArrowResultLink
7
6
import databricks .sql .utils as utils
7
+ from databricks .sql .types import SSLOptions
8
8
9
9
class CloudFetchQueueSuite (unittest .TestCase ):
10
10
@@ -51,7 +51,7 @@ def test_initializer_adds_links(self, mock_create_next_table):
51
51
schema_bytes ,
52
52
result_links = result_links ,
53
53
max_download_threads = 10 ,
54
- ssl_context = create_default_context (),
54
+ ssl_options = SSLOptions (),
55
55
)
56
56
57
57
assert len (queue .download_manager ._pending_links ) == 10
@@ -65,7 +65,7 @@ def test_initializer_no_links_to_add(self):
65
65
schema_bytes ,
66
66
result_links = result_links ,
67
67
max_download_threads = 10 ,
68
- ssl_context = create_default_context (),
68
+ ssl_options = SSLOptions (),
69
69
)
70
70
71
71
assert len (queue .download_manager ._pending_links ) == 0
@@ -78,7 +78,7 @@ def test_create_next_table_no_download(self, mock_get_next_downloaded_file):
78
78
MagicMock (),
79
79
result_links = [],
80
80
max_download_threads = 10 ,
81
- ssl_context = create_default_context (),
81
+ ssl_options = SSLOptions (),
82
82
)
83
83
84
84
assert queue ._create_next_table () is None
@@ -95,7 +95,7 @@ def test_initializer_create_next_table_success(self, mock_get_next_downloaded_fi
95
95
result_links = [],
96
96
description = description ,
97
97
max_download_threads = 10 ,
98
- ssl_context = create_default_context (),
98
+ ssl_options = SSLOptions (),
99
99
)
100
100
expected_result = self .make_arrow_table ()
101
101
@@ -120,7 +120,7 @@ def test_next_n_rows_0_rows(self, mock_create_next_table):
120
120
result_links = [],
121
121
description = description ,
122
122
max_download_threads = 10 ,
123
- ssl_context = create_default_context (),
123
+ ssl_options = SSLOptions (),
124
124
)
125
125
assert queue .table == self .make_arrow_table ()
126
126
assert queue .table .num_rows == 4
@@ -140,7 +140,7 @@ def test_next_n_rows_partial_table(self, mock_create_next_table):
140
140
result_links = [],
141
141
description = description ,
142
142
max_download_threads = 10 ,
143
- ssl_context = create_default_context (),
143
+ ssl_options = SSLOptions (),
144
144
)
145
145
assert queue .table == self .make_arrow_table ()
146
146
assert queue .table .num_rows == 4
@@ -160,7 +160,7 @@ def test_next_n_rows_more_than_one_table(self, mock_create_next_table):
160
160
result_links = [],
161
161
description = description ,
162
162
max_download_threads = 10 ,
163
- ssl_context = create_default_context (),
163
+ ssl_options = SSLOptions (),
164
164
)
165
165
assert queue .table == self .make_arrow_table ()
166
166
assert queue .table .num_rows == 4
@@ -180,7 +180,7 @@ def test_next_n_rows_only_one_table_returned(self, mock_create_next_table):
180
180
result_links = [],
181
181
description = description ,
182
182
max_download_threads = 10 ,
183
- ssl_context = create_default_context (),
183
+ ssl_options = SSLOptions (),
184
184
)
185
185
assert queue .table == self .make_arrow_table ()
186
186
assert queue .table .num_rows == 4
@@ -199,7 +199,7 @@ def test_next_n_rows_empty_table(self, mock_create_next_table):
199
199
result_links = [],
200
200
description = description ,
201
201
max_download_threads = 10 ,
202
- ssl_context = create_default_context (),
202
+ ssl_options = SSLOptions (),
203
203
)
204
204
assert queue .table is None
205
205
@@ -216,7 +216,7 @@ def test_remaining_rows_empty_table_fully_returned(self, mock_create_next_table)
216
216
result_links = [],
217
217
description = description ,
218
218
max_download_threads = 10 ,
219
- ssl_context = create_default_context (),
219
+ ssl_options = SSLOptions (),
220
220
)
221
221
assert queue .table == self .make_arrow_table ()
222
222
assert queue .table .num_rows == 4
@@ -235,7 +235,7 @@ def test_remaining_rows_partial_table_fully_returned(self, mock_create_next_tabl
235
235
result_links = [],
236
236
description = description ,
237
237
max_download_threads = 10 ,
238
- ssl_context = create_default_context (),
238
+ ssl_options = SSLOptions (),
239
239
)
240
240
assert queue .table == self .make_arrow_table ()
241
241
assert queue .table .num_rows == 4
@@ -254,7 +254,7 @@ def test_remaining_rows_one_table_fully_returned(self, mock_create_next_table):
254
254
result_links = [],
255
255
description = description ,
256
256
max_download_threads = 10 ,
257
- ssl_context = create_default_context (),
257
+ ssl_options = SSLOptions (),
258
258
)
259
259
assert queue .table == self .make_arrow_table ()
260
260
assert queue .table .num_rows == 4
@@ -273,7 +273,7 @@ def test_remaining_rows_multiple_tables_fully_returned(self, mock_create_next_ta
273
273
result_links = [],
274
274
description = description ,
275
275
max_download_threads = 10 ,
276
- ssl_context = create_default_context (),
276
+ ssl_options = SSLOptions (),
277
277
)
278
278
assert queue .table == self .make_arrow_table ()
279
279
assert queue .table .num_rows == 4
@@ -293,7 +293,7 @@ def test_remaining_rows_empty_table(self, mock_create_next_table):
293
293
result_links = [],
294
294
description = description ,
295
295
max_download_threads = 10 ,
296
- ssl_context = create_default_context (),
296
+ ssl_options = SSLOptions (),
297
297
)
298
298
assert queue .table is None
299
299
0 commit comments