Skip to content

Commit 3ac2445

Browse files
committed
Added the integration workflow again
1 parent 39316f8 commit 3ac2445

File tree

2 files changed

+66
-6
lines changed

2 files changed

+66
-6
lines changed

.github/workflows/integration.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Integration Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
run-e2e-tests:
11+
runs-on: ubuntu-latest
12+
environment: azure-prod
13+
env:
14+
DATABRICKS_SERVER_HOSTNAME: ${{ secrets.DATABRICKS_HOST }}
15+
DATABRICKS_HTTP_PATH: ${{ secrets.TEST_PECO_WAREHOUSE_HTTP_PATH }}
16+
DATABRICKS_TOKEN: ${{ secrets.DATABRICKS_TOKEN }}
17+
DATABRICKS_CATALOG: peco
18+
DATABRICKS_USER: ${{ secrets.TEST_PECO_SP_ID }}
19+
steps:
20+
#----------------------------------------------
21+
# check-out repo and set-up python
22+
#----------------------------------------------
23+
- name: Check out repository
24+
uses: actions/checkout@v4
25+
- name: Set up python
26+
id: setup-python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.10"
30+
#----------------------------------------------
31+
# ----- install & configure poetry -----
32+
#----------------------------------------------
33+
- name: Install Poetry
34+
uses: snok/install-poetry@v1
35+
with:
36+
virtualenvs-create: true
37+
virtualenvs-in-project: true
38+
installer-parallel: true
39+
40+
#----------------------------------------------
41+
# load cached venv if cache exists
42+
#----------------------------------------------
43+
- name: Load cached venv
44+
id: cached-poetry-dependencies
45+
uses: actions/cache@v4
46+
with:
47+
path: .venv
48+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ github.event.repository.name }}-${{ hashFiles('**/poetry.lock') }}
49+
#----------------------------------------------
50+
# install dependencies if cache does not exist
51+
#----------------------------------------------
52+
- name: Install dependencies
53+
run: poetry install --no-interaction --all-extras
54+
#----------------------------------------------
55+
# run test suite
56+
#----------------------------------------------
57+
- name: Run e2e tests
58+
run: poetry run python -m pytest tests/e2e -n auto

tests/e2e/test_parameterized_queries.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -198,12 +198,14 @@ def _inline_roundtrip(self, params: dict, paramstyle: ParamStyle, target_column)
198198
DELETE_QUERY = f"DELETE FROM {table_name}"
199199

200200
with self.connection(extra_params={"use_inline_params": True}) as conn:
201-
with conn.cursor() as cursor:
202-
cursor.execute(INSERT_QUERY, parameters=params)
203-
with conn.cursor() as cursor:
204-
to_return = cursor.execute(SELECT_QUERY).fetchone()
205-
with conn.cursor() as cursor:
206-
cursor.execute(DELETE_QUERY)
201+
try:
202+
with conn.cursor() as cursor:
203+
cursor.execute(INSERT_QUERY, parameters=params)
204+
with conn.cursor() as cursor:
205+
to_return = cursor.execute(SELECT_QUERY).fetchone()
206+
finally:
207+
with conn.cursor() as cursor:
208+
cursor.execute(DELETE_QUERY)
207209

208210
return to_return
209211

0 commit comments

Comments
 (0)