Skip to content

Commit 8fc58be

Browse files
ahsimbckunki
andauthored
#137: Added retries to the pyexasol_connection fixture (#138)
* #137: Added retries to the `pyexasol_connection` fixture * #137: Added retries to the `pyexasol_connection` fixture * Another attempt to fix formatting * No default db version * Update pytest-backend/doc/changes/unreleased.md Co-authored-by: Christoph Kuhnke <github@kuhnke.net> * Restored the DB version * Moved to ITDE 5.0 * Moved to ITDE 5.0 * not using 3.14 for pytest-extension * not using saas for pytest-extension * prepared pytest-extension release 0.2.5 * prepared pytest-extension release 0.2.5 * trying to free disk space in the ci * trying to change apparmor config * re-enabled saas tests * re-enabled saas tests --------- Co-authored-by: Christoph Kuhnke <github@kuhnke.net>
1 parent 584c773 commit 8fc58be

File tree

13 files changed

+2995
-2463
lines changed

13 files changed

+2995
-2463
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ jobs:
2020
steps:
2121
- id: set-matrix
2222
run: |
23-
# echo "matrix={\"working-directory\": [\"pytest-backend\", \"pytest-extension\", \"pytest-slc\"]}" >> "$GITHUB_OUTPUT"
24-
# Need to release pytest-backend. Other project tests will fail until it's done.
25-
echo "matrix={\"working-directory\": [\"pytest-backend\"]}" >> "$GITHUB_OUTPUT"
23+
echo "matrix={\"working-directory\": [\"pytest-backend\", \"pytest-extension\", \"pytest-slc\"]}" >> "$GITHUB_OUTPUT"
2624
outputs:
2725
matrix: ${{ steps.set-matrix.outputs.matrix }}
2826

@@ -77,6 +75,10 @@ jobs:
7775
with:
7876
working-directory: ${{ matrix.working-directory }}
7977

78+
- name: Allow unprivileged user namespaces
79+
run: |
80+
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
81+
8082
- name: Run slow tests
8183
run: poetry run -- nox -s test:integration -- --coverage
8284
env:
@@ -93,9 +95,7 @@ jobs:
9395
include-hidden-files: true
9496

9597
metrics:
96-
# SaaS tests are having issues at the moment. This should be resolved soon
97-
# and https://github.com/exasol/pytest-plugins/issues/134 can be handled.
98-
needs: [ set-project-matrix, fast-checks ] #, slow-tests ]
98+
needs: [ set-project-matrix, fast-checks, slow-tests ]
9999
strategy:
100100
matrix: ${{ fromJson(needs.set-project-matrix.outputs.matrix) }}
101101
uses: ./.github/workflows/report.yml
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
# Unreleased
1+
# Unreleased
2+
3+
## Summary
4+
5+
This release removes the override `8.18.0` in favor of using the default Docker DB version as defined by ITDE.
6+
7+
## Features
8+
9+
* #139: Removed override `8.18.0` for default Docker DB version used by ITDE

pytest-extension/doc/changes/changelog.md

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# 0.2.5 - 2025-12-11
2+
3+
## Summary
4+
5+
Made SaaS connection more reliable.
6+
7+
## Internal
8+
9+
* #123: Re-locked dependencies to update to exasol-toolbox 1.13.0
10+
* #129: Re-locked dependencies to resolve CVE-2025-66471 (urllib3) and update to exasol-toolbox 3.0.0
11+
12+
## Features
13+
14+
* #137: Added retries to the `pyexasol_connection` fixture.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Unreleased

pytest-extension/doc/changes/unreleased.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

pytest-extension/exasol/pytest_extension/__init__.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
create_bucketfs_conn_object_onprem,
2121
create_bucketfs_conn_object_saas,
2222
)
23+
from tenacity import retry
24+
from tenacity.stop import stop_after_attempt
25+
from tenacity.wait import wait_exponential
2326

2427

2528
@pytest.fixture(scope="session")
@@ -33,6 +36,17 @@ def db_schema_name() -> str:
3336
return "".join(random.choice(string.ascii_uppercase) for _ in range(12))
3437

3538

39+
@retry(
40+
reraise=True,
41+
wait=wait_exponential(multiplier=1, min=5, max=15),
42+
stop=stop_after_attempt(5),
43+
)
44+
def _open_pyexasol_connection(
45+
database_params: dict[str, Any],
46+
) -> pyexasol.ExaConnection:
47+
return pyexasol.connect(**database_params, compression=True)
48+
49+
3650
@pytest.fixture(scope="session")
3751
def pyexasol_connection(
3852
backend_aware_database_params, db_schema_name
@@ -42,17 +56,19 @@ def pyexasol_connection(
4256
creating it if it doesn't exist. In the latter case the schema gets
4357
deleted and the end of the fixture's life span.
4458
"""
45-
with pyexasol.connect(**backend_aware_database_params, compression=True) as conn:
59+
conn = _open_pyexasol_connection(backend_aware_database_params)
60+
use_temp_schema = False
61+
try:
4662
sql = f"SELECT * FROM SYS.EXA_SCHEMAS WHERE SCHEMA_NAME = '{db_schema_name}'"
4763
use_temp_schema = len(conn.execute(sql).fetchall()) == 0
4864
if use_temp_schema:
4965
conn.execute(f'CREATE SCHEMA "{db_schema_name}"')
5066
conn.execute(f'OPEN SCHEMA "{db_schema_name}"')
51-
try:
52-
yield conn
53-
finally:
54-
if use_temp_schema:
55-
conn.execute(f'DROP SCHEMA "{db_schema_name}" CASCADE')
67+
yield conn
68+
finally:
69+
if use_temp_schema:
70+
conn.execute(f'DROP SCHEMA IF EXISTS "{db_schema_name}" CASCADE')
71+
conn.close()
5672

5773

5874
@pytest.fixture(scope="session")

pytest-extension/exasol/pytest_extension/version.py

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pytest-extension/noxconfig.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,6 @@ def post_integration_tests_hook(
4343

4444
PROJECT_CONFIG = Config(
4545
# Uses SaaS; not ITDE DB versions
46+
python_versions=("3.10", "3.11", "3.12", "3.13"),
4647
exasol_versions=(),
4748
)

0 commit comments

Comments
 (0)