Skip to content

SEA: e2e testing #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: sea-migration
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions tests/e2e/common/decimal_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,42 @@ class DecimalTestsMixin:
),
]

@pytest.mark.parametrize(
"backend_params",
[
{},
{
"use_sea": True,
},
],
)
@pytest.mark.parametrize(
"decimal, expected_value, expected_type", decimal_and_expected_results
)
def test_decimals(self, decimal, expected_value, expected_type):
with self.cursor({}) as cursor:
def test_decimals(self, decimal, expected_value, expected_type, backend_params):
with self.cursor(backend_params) as cursor:
query = "SELECT CAST ({})".format(decimal)
cursor.execute(query)
table = cursor.fetchmany_arrow(1)
assert table.field(0).type == expected_type
assert table.to_pydict().popitem()[1][0] == expected_value

@pytest.mark.parametrize(
"backend_params",
[
{},
{
"use_sea": True,
},
],
)
@pytest.mark.parametrize(
"decimals, expected_values, expected_type", multi_decimals_and_expected_results
)
def test_multi_decimals(self, decimals, expected_values, expected_type):
with self.cursor({}) as cursor:
def test_multi_decimals(
self, decimals, expected_values, expected_type, backend_params
):
with self.cursor(backend_params) as cursor:
union_str = " UNION ".join(
["(SELECT CAST ({}))".format(dec) for dec in decimals]
)
Expand Down
61 changes: 53 additions & 8 deletions tests/e2e/common/retry_test_mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,37 @@


class Client429ResponseMixin:
def test_client_should_retry_automatically_when_getting_429(self):
with self.cursor() as cursor:
@pytest.mark.parametrize(
"backend_params",
[
{},
{
"use_sea": True,
},
],
)
def test_client_should_retry_automatically_when_getting_429(self, backend_params):
with self.cursor(backend_params) as cursor:
for _ in range(10):
cursor.execute("SELECT 1")
rows = cursor.fetchall()
self.assertEqual(len(rows), 1)
self.assertEqual(rows[0][0], 1)

def test_client_should_not_retry_429_if_RateLimitRetry_is_0(self):
@pytest.mark.parametrize(
"backend_params",
[
{},
{
"use_sea": True,
},
],
)
def test_client_should_not_retry_429_if_RateLimitRetry_is_0(self, backend_params):
with pytest.raises(self.error_type) as cm:
with self.cursor(self.conf_to_disable_rate_limit_retries) as cursor:
with self.cursor(
{**self.conf_to_disable_rate_limit_retries, **backend_params}
) as cursor:
for _ in range(10):
cursor.execute("SELECT 1")
rows = cursor.fetchall()
Expand All @@ -46,14 +66,39 @@ def test_client_should_not_retry_429_if_RateLimitRetry_is_0(self):


class Client503ResponseMixin:
def test_wait_cluster_startup(self):
with self.cursor() as cursor:
@pytest.mark.parametrize(
"backend_params",
[
{},
{
"use_sea": True,
},
],
)
def test_wait_cluster_startup(self, backend_params):
with self.cursor(backend_params) as cursor:
cursor.execute("SELECT 1")
cursor.fetchall()

def _test_retry_disabled_with_message(self, error_msg_substring, exception_type):
@pytest.mark.parametrize(
"backend_params",
[
{},
{
"use_sea": True,
},
],
)
def _test_retry_disabled_with_message(
self, error_msg_substring, exception_type, backend_params
):
with pytest.raises(exception_type) as cm:
with self.connection(self.conf_to_disable_temporarily_unavailable_retries):
with self.connection(
{
**self.conf_to_disable_temporarily_unavailable_retries,
**backend_params,
}
):
pass
assert error_msg_substring in str(cm.exception)

Expand Down
Loading
Loading