From d7d7e96ce5b3948c482296553cd2e63284cd0efd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Em=C3=ADdio=20Neto?= <9735060+emdneto@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:38:03 -0300 Subject: [PATCH] fix: shellcheck and docker-tests in CI (#2905) --- .../src/generate_workflows_lib/misc.yml.j2 | 2 -- .github/workflows/misc_0.yml | 5 +++++ .../opentelemetry-docker-tests/tests/check_availability.py | 6 +++--- .../tests/sqlalchemy_tests/test_mssql.py | 5 +++-- tox.ini | 2 ++ 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 index 87f726b587..a3fdadf7a3 100644 --- a/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 +++ b/.github/workflows/generate_workflows_lib/src/generate_workflows_lib/misc.yml.j2 @@ -46,13 +46,11 @@ jobs: - name: Checkout pull request run: git checkout ${% raw %}{{ github.event.pull_request.head.sha }}{% endraw %} {%- endif %} - {%- if job_data != "shellcheck" %} - name: Set up Python 3.10 uses: actions/setup-python@v5 with: python-version: "3.10" - {%- endif %} - name: Install tox run: pip install tox diff --git a/.github/workflows/misc_0.yml b/.github/workflows/misc_0.yml index 3c3f7bfacf..edb96b60d1 100644 --- a/.github/workflows/misc_0.yml +++ b/.github/workflows/misc_0.yml @@ -122,6 +122,11 @@ jobs: - name: Checkout repo @ SHA - ${{ github.sha }} uses: actions/checkout@v4 + - name: Set up Python 3.10 + uses: actions/setup-python@v5 + with: + python-version: "3.10" + - name: Install tox run: pip install tox diff --git a/tests/opentelemetry-docker-tests/tests/check_availability.py b/tests/opentelemetry-docker-tests/tests/check_availability.py index f9cd5b998e..4eed135e58 100644 --- a/tests/opentelemetry-docker-tests/tests/check_availability.py +++ b/tests/opentelemetry-docker-tests/tests/check_availability.py @@ -112,9 +112,9 @@ def check_redis_connection(): def new_mssql_connection() -> pyodbc.Connection: connection = pyodbc.connect( - f"DRIVER={{ODBC Driver 17 for SQL Server}};SERVER={MSSQL_HOST}," - f"{MSSQL_PORT};DATABASE=master;UID={MSSQL_USER};" - f"PWD={MSSQL_PASSWORD}", + f"DRIVER={{ODBC Driver 18 for SQL Server}};SERVER={MSSQL_HOST}," + f"{MSSQL_PORT};DATABASE=master;UID={MSSQL_USER};TrustServerCertificate=yes;" + f"PWD={MSSQL_PASSWORD};", autocommit=True, ) return connection diff --git a/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mssql.py b/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mssql.py index 713be24198..b92228c5cd 100644 --- a/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mssql.py +++ b/tests/opentelemetry-docker-tests/tests/sqlalchemy_tests/test_mssql.py @@ -28,7 +28,8 @@ "user": os.getenv("TEST_MSSQL_USER", "sa"), "password": os.getenv("TEST_MSSQL_PASSWORD", "yourStrong(!)Password"), "database": os.getenv("TEST_MSSQL_DATABASE", "opentelemetry-tests"), - "driver": os.getenv("TEST_MSSQL_DRIVER", "ODBC+Driver+17+for+SQL+Server"), + "driver": os.getenv("TEST_MSSQL_DRIVER", "ODBC+Driver+18+for+SQL+Server"), + "trusted_connection": os.getenv("TEST_MSSQL_TRUSTED_CONNECTION", "yes"), } @@ -40,7 +41,7 @@ class MssqlConnectorTestCase(SQLAlchemyTestMixin): VENDOR = "mssql" SQL_DB = "opentelemetry-tests" ENGINE_ARGS = { - "url": "mssql+pyodbc://%(user)s:%(password)s@%(host)s:%(port)s/%(database)s?driver=%(driver)s" + "url": "mssql+pyodbc://%(user)s:%(password)s@%(host)s:%(port)s/%(database)s?driver=%(driver)s&TrustServerCertificate=%(trusted_connection)s" % MSSQL_CONFIG } diff --git a/tox.ini b/tox.ini index 2b0995d8fc..5bf05d451f 100644 --- a/tox.ini +++ b/tox.ini @@ -1286,6 +1286,8 @@ changedir = tests/opentelemetry-docker-tests/tests commands_pre = + sh -c "sudo apt update -y && sudo ACCEPT_EULA=Y apt-get install -y msodbcsql18 unixodbc-dev unixodbc" + python -c "import pyodbc; print(pyodbc.drivers())" pip install {env:CORE_REPO}\#egg=opentelemetry-api&subdirectory=opentelemetry-api \ {env:CORE_REPO}\#egg=opentelemetry-semantic-conventions&subdirectory=opentelemetry-semantic-conventions \ {env:CORE_REPO}\#egg=opentelemetry-sdk&subdirectory=opentelemetry-sdk \