|
12 | 12 | from firebolt.common._types import ColType |
13 | 13 | from firebolt.common.row_set.types import Column |
14 | 14 | from firebolt.utils.exception import FireboltStructuredError |
| 15 | +from tests.integration.dbapi.conftest import LONG_SELECT_DEFAULT_V2 |
15 | 16 | from tests.integration.dbapi.utils import assert_deep_eq |
16 | 17 |
|
17 | 18 | VALS_TO_INSERT_2 = ",".join( |
18 | 19 | [f"({i}, {i-3}, '{val}')" for (i, val) in enumerate(range(4, 1000))] |
19 | 20 | ) |
20 | 21 | LONG_INSERT = f'INSERT INTO "test_tbl" VALUES {VALS_TO_INSERT_2}' |
21 | 22 | LONG_SELECT = ( |
22 | | - "SELECT checksum(*) FROM GENERATE_SERIES(1, 400000000000)" # approx 6m runtime |
| 23 | + "SELECT checksum(*) FROM GENERATE_SERIES(1, {long_value})" # approx 6m runtime |
23 | 24 | ) |
24 | 25 |
|
25 | 26 |
|
@@ -102,13 +103,16 @@ async def test_select_nan(connection: Connection) -> None: |
102 | 103 | async def test_long_query( |
103 | 104 | connection: Connection, |
104 | 105 | minimal_time: Callable[[float], None], |
| 106 | + long_test_value: Callable[[int], int], |
105 | 107 | ) -> None: |
106 | 108 | """AWS ALB TCP timeout set to 350; make sure we handle the keepalive correctly.""" |
107 | 109 |
|
108 | 110 | minimal_time(350) |
109 | 111 |
|
110 | 112 | async with connection.cursor() as c: |
111 | | - await c.execute(LONG_SELECT) |
| 113 | + await c.execute( |
| 114 | + LONG_SELECT.format(long_value=long_test_value(LONG_SELECT_DEFAULT_V2)) |
| 115 | + ) |
112 | 116 | data = await c.fetchall() |
113 | 117 | assert len(data) == 1, "Invalid data size returned by fetchall" |
114 | 118 |
|
@@ -265,16 +269,16 @@ async def test_empty_query(c: Cursor, query: str, params: tuple) -> None: |
265 | 269 | async def test_parameterized_query_with_special_chars(connection: Connection) -> None: |
266 | 270 | """Query parameters are handled properly.""" |
267 | 271 | async with connection.cursor() as c: |
268 | | - params = ["text with 'quote'", "text with \\slashes"] |
| 272 | + parameters = ["text with 'quote'", "text with \\slashes"] |
269 | 273 |
|
270 | 274 | await c.execute( |
271 | 275 | "SELECT ? as one, ? as two", |
272 | | - params, |
| 276 | + parameters, |
273 | 277 | ) |
274 | 278 |
|
275 | 279 | result = await c.fetchall() |
276 | 280 | assert result == [ |
277 | | - [params[0], params[1]] |
| 281 | + [parameters[0], parameters[1]] |
278 | 282 | ], "Invalid data in table after parameterized insert" |
279 | 283 |
|
280 | 284 |
|
|
0 commit comments