Skip to content

Commit 7d10756

Browse files
add more sea e2e testing
Signed-off-by: varun-edachali-dbx <varun.edachali@databricks.com>
1 parent 922c448 commit 7d10756

File tree

6 files changed

+350
-62
lines changed

6 files changed

+350
-62
lines changed

tests/e2e/common/decimal_tests.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,42 @@ class DecimalTestsMixin:
3838
),
3939
]
4040

41+
@pytest.mark.parametrize(
42+
"backend_params",
43+
[
44+
{},
45+
{
46+
"use_sea": True,
47+
},
48+
],
49+
)
4150
@pytest.mark.parametrize(
4251
"decimal, expected_value, expected_type", decimal_and_expected_results
4352
)
44-
def test_decimals(self, decimal, expected_value, expected_type):
45-
with self.cursor({}) as cursor:
53+
def test_decimals(self, decimal, expected_value, expected_type, backend_params):
54+
with self.cursor(backend_params) as cursor:
4655
query = "SELECT CAST ({})".format(decimal)
4756
cursor.execute(query)
4857
table = cursor.fetchmany_arrow(1)
4958
assert table.field(0).type == expected_type
5059
assert table.to_pydict().popitem()[1][0] == expected_value
5160

61+
@pytest.mark.parametrize(
62+
"backend_params",
63+
[
64+
{},
65+
{
66+
"use_sea": True,
67+
},
68+
],
69+
)
5270
@pytest.mark.parametrize(
5371
"decimals, expected_values, expected_type", multi_decimals_and_expected_results
5472
)
55-
def test_multi_decimals(self, decimals, expected_values, expected_type):
56-
with self.cursor({}) as cursor:
73+
def test_multi_decimals(
74+
self, decimals, expected_values, expected_type, backend_params
75+
):
76+
with self.cursor(backend_params) as cursor:
5777
union_str = " UNION ".join(
5878
["(SELECT CAST ({}))".format(dec) for dec in decimals]
5979
)

tests/e2e/common/large_queries_mixin.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,16 @@ def fetch_rows(self, cursor, row_count, fetchmany_size):
4242
+ "assuming 10K fetch size."
4343
)
4444

45-
def test_query_with_large_wide_result_set(self):
45+
@pytest.mark.parametrize(
46+
"backend_params",
47+
[
48+
{},
49+
{
50+
"use_sea": True,
51+
},
52+
],
53+
)
54+
def test_query_with_large_wide_result_set(self, backend_params):
4655
resultSize = 300 * 1000 * 1000 # 300 MB
4756
width = 8192 # B
4857
rows = resultSize // width
@@ -52,7 +61,7 @@ def test_query_with_large_wide_result_set(self):
5261
fetchmany_size = 10 * 1024 * 1024 // width
5362
# This is used by PyHive tests to determine the buffer size
5463
self.arraysize = 1000
55-
with self.cursor() as cursor:
64+
with self.cursor(backend_params) as cursor:
5665
for lz4_compression in [False, True]:
5766
cursor.connection.lz4_compression = lz4_compression
5867
uuids = ", ".join(["uuid() uuid{}".format(i) for i in range(cols)])
@@ -68,7 +77,16 @@ def test_query_with_large_wide_result_set(self):
6877
assert row[0] == row_id # Verify no rows are dropped in the middle.
6978
assert len(row[1]) == 36
7079

71-
def test_query_with_large_narrow_result_set(self):
80+
@pytest.mark.parametrize(
81+
"backend_params",
82+
[
83+
{},
84+
{
85+
"use_sea": True,
86+
},
87+
],
88+
)
89+
def test_query_with_large_narrow_result_set(self, backend_params):
7290
resultSize = 300 * 1000 * 1000 # 300 MB
7391
width = 8 # sizeof(long)
7492
rows = resultSize / width
@@ -77,12 +95,21 @@ def test_query_with_large_narrow_result_set(self):
7795
fetchmany_size = 10 * 1024 * 1024 // width
7896
# This is used by PyHive tests to determine the buffer size
7997
self.arraysize = 10000000
80-
with self.cursor() as cursor:
98+
with self.cursor(backend_params) as cursor:
8199
cursor.execute("SELECT * FROM RANGE({rows})".format(rows=rows))
82100
for row_id, row in enumerate(self.fetch_rows(cursor, rows, fetchmany_size)):
83101
assert row[0] == row_id
84102

85-
def test_long_running_query(self):
103+
@pytest.mark.parametrize(
104+
"backend_params",
105+
[
106+
{},
107+
{
108+
"use_sea": True,
109+
},
110+
],
111+
)
112+
def test_long_running_query(self, backend_params):
86113
"""Incrementally increase query size until it takes at least 3 minutes,
87114
and asserts that the query completes successfully.
88115
"""
@@ -92,7 +119,7 @@ def test_long_running_query(self):
92119
duration = -1
93120
scale0 = 10000
94121
scale_factor = 1
95-
with self.cursor() as cursor:
122+
with self.cursor(backend_params) as cursor:
96123
while duration < min_duration:
97124
assert scale_factor < 1024, "Detected infinite loop"
98125
start = time.time()

tests/e2e/common/retry_test_mixins.py

Lines changed: 53 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,37 @@
1717

1818

1919
class Client429ResponseMixin:
20-
def test_client_should_retry_automatically_when_getting_429(self):
21-
with self.cursor() as cursor:
20+
@pytest.mark.parametrize(
21+
"backend_params",
22+
[
23+
{},
24+
{
25+
"use_sea": True,
26+
},
27+
],
28+
)
29+
def test_client_should_retry_automatically_when_getting_429(self, backend_params):
30+
with self.cursor(backend_params) as cursor:
2231
for _ in range(10):
2332
cursor.execute("SELECT 1")
2433
rows = cursor.fetchall()
2534
self.assertEqual(len(rows), 1)
2635
self.assertEqual(rows[0][0], 1)
2736

28-
def test_client_should_not_retry_429_if_RateLimitRetry_is_0(self):
37+
@pytest.mark.parametrize(
38+
"backend_params",
39+
[
40+
{},
41+
{
42+
"use_sea": True,
43+
},
44+
],
45+
)
46+
def test_client_should_not_retry_429_if_RateLimitRetry_is_0(self, backend_params):
2947
with pytest.raises(self.error_type) as cm:
30-
with self.cursor(self.conf_to_disable_rate_limit_retries) as cursor:
48+
with self.cursor(
49+
{**self.conf_to_disable_rate_limit_retries, **backend_params}
50+
) as cursor:
3151
for _ in range(10):
3252
cursor.execute("SELECT 1")
3353
rows = cursor.fetchall()
@@ -46,14 +66,39 @@ def test_client_should_not_retry_429_if_RateLimitRetry_is_0(self):
4666

4767

4868
class Client503ResponseMixin:
49-
def test_wait_cluster_startup(self):
50-
with self.cursor() as cursor:
69+
@pytest.mark.parametrize(
70+
"backend_params",
71+
[
72+
{},
73+
{
74+
"use_sea": True,
75+
},
76+
],
77+
)
78+
def test_wait_cluster_startup(self, backend_params):
79+
with self.cursor(backend_params) as cursor:
5180
cursor.execute("SELECT 1")
5281
cursor.fetchall()
5382

54-
def _test_retry_disabled_with_message(self, error_msg_substring, exception_type):
83+
@pytest.mark.parametrize(
84+
"backend_params",
85+
[
86+
{},
87+
{
88+
"use_sea": True,
89+
},
90+
],
91+
)
92+
def _test_retry_disabled_with_message(
93+
self, error_msg_substring, exception_type, backend_params
94+
):
5595
with pytest.raises(exception_type) as cm:
56-
with self.connection(self.conf_to_disable_temporarily_unavailable_retries):
96+
with self.connection(
97+
{
98+
**self.conf_to_disable_temporarily_unavailable_retries,
99+
**backend_params,
100+
}
101+
):
57102
pass
58103
assert error_msg_substring in str(cm.exception)
59104

0 commit comments

Comments
 (0)