Skip to content

Commit db9e51d

Browse files
authored
test: Remove advanced_mode flag (#329)
1 parent cd17e84 commit db9e51d

File tree

9 files changed

+50
-47
lines changed

9 files changed

+50
-47
lines changed

.github/workflows/integration-tests-v1.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
API_ENDPOINT: "api.${{ inputs.environment }}.firebolt.io"
9696
ACCOUNT_NAME: "firebolt"
9797
run: |
98-
pytest --last-failed -n 6 --dist loadgroup --timeout_method "signal" -o log_cli=true -o log_cli_level=INFO tests/integration -k "not V2"
98+
pytest --last-failed -n 6 --dist loadgroup --timeout_method "signal" -o log_cli=true -o log_cli_level=INFO tests/integration -k "not V2" --runslow
9999
100100
- name: Save failed tests
101101
id: cache-tests-save

.github/workflows/integration-tests-v2.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ jobs:
7171
API_ENDPOINT: "api.${{ inputs.environment }}.firebolt.io"
7272
ACCOUNT_NAME: "developer"
7373
run: |
74-
pytest -n 6 --dist loadgroup --timeout_method "signal" -o log_cli=true -o log_cli_level=WARNING tests/integration -k "not V1"
74+
pytest -n 6 --dist loadgroup --timeout_method "signal" -o log_cli=true -o log_cli_level=WARNING tests/integration -k "not V1" --runslow

src/firebolt/async_db/cursor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ async def _do_execute(
182182
query,
183183
{
184184
"async_execution": 1,
185-
"advanced_mode": 1,
186185
"output_format": JSON_OUTPUT_FORMAT,
187186
},
188187
)

src/firebolt/db/cursor.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ def _do_execute(
171171
query,
172172
{
173173
"async_execution": 1,
174-
"advanced_mode": 1,
175174
"output_format": JSON_OUTPUT_FORMAT,
176175
},
177176
)

tests/integration/conftest.py

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from logging import getLogger
22
from os import environ
33

4-
from pytest import fixture
4+
from pytest import fixture, mark
55

66
from firebolt.client.auth import ClientCredentials
77
from firebolt.client.auth.username_password import UsernamePassword
@@ -20,6 +20,29 @@
2020
ENGINE_URL_ENV = "ENGINE_URL"
2121
STOPPED_ENGINE_URL_ENV = "STOPPED_ENGINE_URL"
2222

23+
# https://docs.pytest.org/en/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option
24+
# Adding slow marker to tests
25+
26+
27+
def pytest_addoption(parser):
28+
parser.addoption(
29+
"--runslow", action="store_true", default=False, help="run slow tests"
30+
)
31+
32+
33+
def pytest_configure(config):
34+
config.addinivalue_line("markers", "slow: mark test as slow to run")
35+
36+
37+
def pytest_collection_modifyitems(config, items):
38+
if config.getoption("--runslow"):
39+
# --runslow given in cli: do not skip slow tests
40+
return
41+
skip_slow = mark.skip(reason="need --runslow option to run")
42+
for item in items:
43+
if "slow" in item.keywords:
44+
item.add_marker(skip_slow)
45+
2346

2447
class Secret:
2548
"""

tests/integration/dbapi/async/V1/test_queries_async.py

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,6 @@ async def test_select(
135135
) -> None:
136136
"""Select handles all data types properly."""
137137
with connection.cursor() as c:
138-
assert (
139-
await c.execute(f"SET advanced_mode=1") == -1
140-
), "Invalid set statment row count"
141138
# For timestamptz test
142139
assert (
143140
await c.execute(f"SET time_zone={timezone_name}") == -1
@@ -172,21 +169,19 @@ async def test_select(
172169
)
173170

174171

175-
@mark.skip("Don't have a good way to test this anymore. FIR-16038")
176-
@mark.timeout(timeout=400)
172+
@mark.skip(reason="V1 query doesn't finish within the timeout")
173+
@mark.slow
174+
@mark.timeout(timeout=600)
177175
async def test_long_query(
178176
connection: Connection,
179177
) -> None:
180178
"""AWS ALB TCP timeout set to 350; make sure we handle the keepalive correctly."""
181179
with connection.cursor() as c:
182180
await c.execute(
183-
"SET advanced_mode = 1; SET use_standard_sql = 0;"
184-
"SELECT sleepEachRow(1) from numbers(360)",
181+
"SELECT checksum(*) FROM GENERATE_SERIES(1, 200000000000)", # approx 6m runtime
185182
)
186-
await c.nextset()
187-
await c.nextset()
188183
data = await c.fetchall()
189-
assert len(data) == 360, "Invalid data size returned by fetchall"
184+
assert len(data) == 1, "Invalid data size returned by fetchall"
190185

191186

192187
async def test_drop_create(connection: Connection) -> None:

tests/integration/dbapi/async/V2/test_queries_async.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ async def test_select(
6464
) -> None:
6565
"""Select handles all data types properly."""
6666
with connection.cursor() as c:
67-
assert (
68-
await c.execute(f"SET advanced_mode=1") == -1
69-
), "Invalid set statment row count"
7067
# For timestamptz test
7168
assert (
7269
await c.execute(f"SET time_zone={timezone_name}") == -1
@@ -101,21 +98,18 @@ async def test_select(
10198
)
10299

103100

104-
@mark.skip("Don't have a good way to test this anymore. FIR-16038")
105-
@mark.timeout(timeout=400)
101+
@mark.slow
102+
@mark.timeout(timeout=550)
106103
async def test_long_query(
107104
connection: Connection,
108105
) -> None:
109106
"""AWS ALB TCP timeout set to 350; make sure we handle the keepalive correctly."""
110107
with connection.cursor() as c:
111108
await c.execute(
112-
"SET advanced_mode = 1; SET use_standard_sql = 0;"
113-
"SELECT sleepEachRow(1) from numbers(360)",
109+
"SELECT checksum(*) FROM GENERATE_SERIES(1, 200000000000)", # approx 6m runtime
114110
)
115-
await c.nextset()
116-
await c.nextset()
117111
data = await c.fetchall()
118-
assert len(data) == 360, "Invalid data size returned by fetchall"
112+
assert len(data) == 1, "Invalid data size returned by fetchall"
119113

120114

121115
async def test_drop_create(connection: Connection) -> None:
@@ -400,17 +394,17 @@ async def test_bytea_roundtrip(
400394
) -> None:
401395
"""Inserted and than selected bytea value doesn't get corrupted."""
402396
with connection.cursor() as c:
403-
await c.execute("DROP TABLE IF EXISTS test_bytea_roundtrip")
397+
await c.execute("DROP TABLE IF EXISTS test_bytea_roundtrip_2")
404398
await c.execute(
405-
"CREATE FACT TABLE test_bytea_roundtrip(id int, b bytea) primary index id"
399+
"CREATE FACT TABLE test_bytea_roundtrip_2(id int, b bytea) primary index id"
406400
)
407401

408402
data = "bytea_123\n\tヽ༼ຈل͜ຈ༽ノ"
409403

410404
await c.execute(
411-
"INSERT INTO test_bytea_roundtrip VALUES (1, ?)", (Binary(data),)
405+
"INSERT INTO test_bytea_roundtrip_2 VALUES (1, ?)", (Binary(data),)
412406
)
413-
await c.execute("SELECT b FROM test_bytea_roundtrip")
407+
await c.execute("SELECT b FROM test_bytea_roundtrip_2")
414408

415409
bytes_data = (await c.fetchone())[0]
416410

tests/integration/dbapi/sync/V1/test_queries.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ def test_select(
8888
) -> None:
8989
"""Select handles all data types properly."""
9090
with connection.cursor() as c:
91-
assert c.execute(f"SET advanced_mode=1") == -1, "Invalid set statment row count"
9291
# For timestamptz test
9392
assert (
9493
c.execute(f"SET time_zone={timezone_name}") == -1
@@ -121,22 +120,19 @@ def test_select(
121120
)
122121

123122

124-
@mark.skip("Don't have a good way to test this anymore. FIR-16038")
125-
@mark.timeout(timeout=400)
123+
@mark.skip(reason="V1 query doesn't finish within the timeout")
124+
@mark.slow
125+
@mark.timeout(timeout=600)
126126
def test_long_query(
127127
connection: Connection,
128128
) -> None:
129129
"""AWS ALB TCP timeout set to 350, make sure we handle the keepalive correctly."""
130130
with connection.cursor() as c:
131131
c.execute(
132-
"SET advanced_mode=1;"
133-
"SET use_standard_sql=0;"
134-
"SELECT sleepEachRow(1) FROM numbers(360)",
132+
"SELECT checksum(*) FROM GENERATE_SERIES(1, 200000000000)", # approx 6m runtime
135133
)
136-
c.nextset()
137-
c.nextset()
138134
data = c.fetchall()
139-
assert len(data) == 360, "Invalid data size returned by fetchall"
135+
assert len(data) == 1, "Invalid data size returned by fetchall"
140136

141137

142138
def test_drop_create(connection: Connection) -> None:
@@ -451,6 +447,7 @@ async def test_server_side_async_execution_get_status(
451447
# ), "get_status() did not return a QueryStatus object."
452448

453449

450+
@mark.xdist_group("multi_thread_connection_sharing")
454451
def test_multi_thread_connection_sharing(
455452
engine_url: str,
456453
database_name: str,

tests/integration/dbapi/sync/V2/test_queries.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def test_select(
7272
) -> None:
7373
"""Select handles all data types properly."""
7474
with connection.cursor() as c:
75-
assert c.execute(f"SET advanced_mode=1") == -1, "Invalid set statment row count"
7675
# For timestamptz test
7776
assert (
7877
c.execute(f"SET time_zone={timezone_name}") == -1
@@ -105,22 +104,18 @@ def test_select(
105104
)
106105

107106

108-
@mark.skip("Don't have a good way to test this anymore. FIR-16038")
109-
@mark.timeout(timeout=400)
107+
@mark.slow
108+
@mark.timeout(timeout=550)
110109
def test_long_query(
111110
connection: Connection,
112111
) -> None:
113112
"""AWS ALB TCP timeout set to 350, make sure we handle the keepalive correctly."""
114113
with connection.cursor() as c:
115114
c.execute(
116-
"SET advanced_mode=1;"
117-
"SET use_standard_sql=0;"
118-
"SELECT sleepEachRow(1) FROM numbers(360)",
115+
"SELECT checksum(*) FROM GENERATE_SERIES(1, 200000000000)", # approx 6m runtime
119116
)
120-
c.nextset()
121-
c.nextset()
122117
data = c.fetchall()
123-
assert len(data) == 360, "Invalid data size returned by fetchall"
118+
assert len(data) == 1, "Invalid data size returned by fetchall"
124119

125120

126121
def test_drop_create(connection: Connection) -> None:
@@ -434,6 +429,7 @@ async def test_server_side_async_execution_get_status(
434429
# ), "get_status() did not return a QueryStatus object."
435430

436431

432+
@mark.xdist_group("multi_thread_connection_sharing")
437433
def test_multi_thread_connection_sharing(
438434
engine_name: str,
439435
database_name: str,

0 commit comments

Comments
 (0)