Skip to content

Commit 7ddd8cd

Browse files
committed
Move system dependencies intall to workflow
And make ms sql odbc driver optional so you can run tests locally without accepting the EULA.
1 parent 7e65e1a commit 7ddd8cd

5 files changed

Lines changed: 20 additions & 7 deletions

File tree

.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ jobs:
6868
- name: Install tox
6969
run: pip install tox-uv
7070

71+
{%- if job_data == "docker-tests" %}
72+
73+
- name: Install Microsft SQL ODBC driver
74+
run: sudo apt update -y && ACCEPT_EULA=Y sudo apt install -y msodbcsql18 unixodbc-dev unixodbc
75+
{%- endif %}
76+
7177
- name: Run tests
7278
run: tox -e {{ job_data }}
7379
{%- if job_data == "generate-workflows" %}

.github/workflows/misc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ jobs:
5858

5959
- name: Install tox
6060
run: pip install tox-uv
61+
- name: Install Microsft SQL ODBC driver
62+
run: ACCEPT_EULA=Y sudo apt install -y msodbcsql18 unixodbc-dev unixodbc
6163

6264
- name: Run tests
6365
run: tox -e docker-tests

tests/opentelemetry-docker-tests/tests/check_availability.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,11 @@ def check_docker_services_availability():
130130
check_mysql_connection()
131131
check_postgres_connection()
132132
check_redis_connection()
133-
check_mssql_connection()
134-
setup_mssql_db()
133+
134+
# make accepting EULA for ms sql odbc driver optional
135+
if "ODBC Driver 18 for SQL Server" in pyodbc.drivers():
136+
check_mssql_connection()
137+
setup_mssql_db()
135138

136139

137140
check_docker_services_availability()

tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mssql.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import os
55

6+
import pyodbc
67
import pytest
78
from sqlalchemy.exc import ProgrammingError
89

@@ -30,6 +31,10 @@
3031
}
3132

3233

34+
@pytest.mark.skipif(
35+
"ODBC Driver 18 for SQL Server" not in pyodbc.drivers(),
36+
reason="No MS SQL odbc driver installed",
37+
)
3338
class MssqlConnectorTestCase(SQLAlchemyTestMixin):
3439
"""TestCase for pyodbc engine"""
3540

tox.ini

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,11 +1088,8 @@ allowlist_externals =
10881088
sh
10891089

10901090
commands_pre =
1091-
; this assumes an ubuntu system
1092-
sh -c "sudo apt update -y"
1093-
sh -c "docker --version || sudo apt install -y docker.io docker-compose-v2"
1094-
sh -c "sudo ACCEPT_EULA=Y apt install -y msodbcsql18 unixodbc-dev unixodbc"
1095-
python -c "import pyodbc; print(pyodbc.drivers())"
1091+
sh -c "docker --version || echo "Docker with compose subcommand is required" && /bin/false"
1092+
sh -c "python -c 'import pyodbc; print(pyodbc.drivers())' || echo "You need to install unixODBC"
10961093
docker compose up -d
10971094
python check_availability.py
10981095

0 commit comments

Comments
 (0)