Skip to content

Commit 178ab95

Browse files
SNOW-UD: Add inline UD test workflow with isolated tox environments
- Add ud-inline-tests.yml (workflow_dispatch only) to run Snowpark tests against the universal-driver Python connector installed from git+https. - Add scripts/ud_tox_install_cmd.sh — wrapper that delegates to the standard tox_install_cmd.sh, then swaps snowflake-connector-python for the UD connector. Original install script is untouched. - Add [testenv:ud] and [testenv:ud-datasource] to tox.ini with their own install_command, passenv, and setenv. No changes to [testenv]. No behavior change for regular Snowpark CI — UD install logic is fully isolated in the new wrapper script and testenv sections. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent a540a2d commit 178ab95

3 files changed

Lines changed: 154 additions & 0 deletions

File tree

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: Run UD tests inline (manual)
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ud-branch:
7+
description: 'Branch of universal-driver repo to use'
8+
required: false
9+
default: 'snowpark-compatibility'
10+
type: string
11+
python-version:
12+
description: 'Python version'
13+
required: false
14+
default: '3.10'
15+
type: choice
16+
options:
17+
- '3.10'
18+
- '3.11'
19+
- '3.12'
20+
- '3.13'
21+
cloud-provider:
22+
description: 'Cloud provider'
23+
required: false
24+
default: 'aws'
25+
type: choice
26+
options:
27+
- 'aws'
28+
- 'azure'
29+
- 'gcp'
30+
31+
permissions:
32+
contents: read
33+
34+
env:
35+
PYTHON_VERSION: ${{ inputs.python-version || '3.10' }}
36+
CLOUD_PROVIDER: ${{ inputs.cloud-provider || 'aws' }}
37+
UD_BRANCH: ${{ inputs.ud-branch || 'snowpark-compatibility' }}
38+
39+
jobs:
40+
test:
41+
name: UD Test py${{ inputs.python-version || '3.10' }}-${{ inputs.cloud-provider || 'aws' }} (${{ inputs.ud-branch || 'snowpark-compatibility' }})
42+
runs-on: ubuntu-latest-64-cores
43+
44+
steps:
45+
- uses: actions/checkout@v4
46+
with:
47+
persist-credentials: false
48+
49+
- uses: actions/setup-python@v5
50+
with:
51+
python-version: ${{ env.PYTHON_VERSION }}
52+
53+
- run: python -c "import sys; print(sys.version)"
54+
55+
- uses: astral-sh/setup-uv@v6
56+
57+
- name: Decrypt parameters.py
58+
run: .github/scripts/decrypt_parameters.sh
59+
env:
60+
PARAMETER_PASSWORD: ${{ secrets.PARAMETER_PASSWORD }}
61+
CLOUD_PROVIDER: ${{ env.CLOUD_PROVIDER }}
62+
63+
- name: Install protoc
64+
run: .github/scripts/install_protoc.sh
65+
66+
- name: Configure git credentials for universal-driver
67+
run: |
68+
git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"
69+
env:
70+
GH_TOKEN: ${{ secrets.SNOWFLAKE_GITHUB_TOKEN }}
71+
72+
- name: Install tox
73+
run: uv pip install tox --system
74+
75+
- name: Install MS ODBC Driver
76+
run: |
77+
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
78+
curl https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/prod.list \
79+
| sudo tee /etc/apt/sources.list.d/mssql-release.list
80+
sudo apt-get update
81+
sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev
82+
83+
- name: Run integration tests
84+
run: python -m tox -e ud
85+
env:
86+
cloud_provider: ${{ env.CLOUD_PROVIDER }}
87+
ud_connector_path: "git+https://github.com/snowflakedb/universal-driver@${{ env.UD_BRANCH }}#subdirectory=python"
88+
GH_TOKEN: ${{ secrets.SNOWFLAKE_GITHUB_TOKEN }}
89+
PYTEST_ADDOPTS: --color=yes --tb=short
90+
TOX_PARALLEL_NO_SPINNER: 1
91+
92+
- name: Run datasource tests
93+
run: python -m tox -e ud-datasource
94+
env:
95+
cloud_provider: ${{ env.CLOUD_PROVIDER }}
96+
ud_connector_path: "git+https://github.com/snowflakedb/universal-driver@${{ env.UD_BRANCH }}#subdirectory=python"
97+
GH_TOKEN: ${{ secrets.SNOWFLAKE_GITHUB_TOKEN }}
98+
PYTEST_ADDOPTS: --color=yes --tb=short
99+
TOX_PARALLEL_NO_SPINNER: 1

scripts/ud_tox_install_cmd.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
set -e
3+
4+
# Run normal install first (deps + project)
5+
bash ./scripts/tox_install_cmd.sh "$@"
6+
7+
# Swap connector if ud_connector_path is set
8+
ud_connector_path=${ud_connector_path:-""}
9+
if [[ -n "${ud_connector_path}" ]]; then
10+
echo "Swapping snowflake-connector-python → Universal Driver"
11+
echo "UD connector path: ${ud_connector_path}"
12+
# Remove old connector and install UD in its place.
13+
# --reinstall ensures wheel files are always extracted even if the version
14+
# matches a previous install (uv otherwise skips re-extraction silently).
15+
uv pip uninstall snowflake-connector-python
16+
uv pip install --reinstall "${ud_connector_path}"
17+
fi

tox.ini

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,44 @@ deps =
264264
commands =
265265
{env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE}" {posargs:} tests/integ/datasource -n 8
266266

267+
[testenv:ud]
268+
description = run integration tests with Universal Driver connector
269+
allowlist_externals = bash
270+
install_command = bash ./scripts/ud_tox_install_cmd.sh {opts} {packages}
271+
passenv =
272+
{[testenv]passenv}
273+
ud_connector_path
274+
LD_PRELOAD
275+
setenv =
276+
{[testenv]setenv}
277+
SNOWFLAKE_PYTEST_VERBOSITY = -vvv
278+
SNOWFLAKE_PYTEST_PARALLELISM = -n logical
279+
SNOWFLAKE_TEST_TYPE = (unit or integ or doctest)
280+
LD_PRELOAD = {env:LD_PRELOAD:}
281+
commands =
282+
{env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE} or udf" {posargs:} {env:RERUN_FLAGS} tests
283+
284+
[testenv:ud-datasource]
285+
description = run datasource tests with Universal Driver connector
286+
allowlist_externals = bash
287+
install_command = bash ./scripts/ud_tox_install_cmd.sh {opts} {packages}
288+
passenv =
289+
{[testenv]passenv}
290+
ud_connector_path
291+
LD_PRELOAD
292+
setenv =
293+
{[testenv]setenv}
294+
LD_PRELOAD = {env:LD_PRELOAD:}
295+
deps =
296+
{[testenv]deps}
297+
databricks-sql-connector > 4.0.0
298+
oracledb
299+
psycopg2-binary
300+
pymysql
301+
pyodbc
302+
commands =
303+
{env:SNOWFLAKE_PYTEST_CMD} -m "{env:SNOWFLAKE_TEST_TYPE}" {posargs:} tests/integ/datasource -n 8
304+
267305
[pytest]
268306
log_cli = True
269307
log_cli_level = DEBUG

0 commit comments

Comments
 (0)