Skip to content

Commit

Permalink
Merge branch 'main' into respect-tracer-provider-sqlalchemy
Browse files Browse the repository at this point in the history
  • Loading branch information
owais authored Oct 12, 2021
2 parents d5b7662 + b41a917 commit f55d582
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
matrix:
python-version: [ py36, py37, py38, py39, pypy3 ]
package: ["instrumentation", "exporter", "sdkextension", "propagator"]
os: [ ubuntu-latest ]
os: [ ubuntu-20.04 ]
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
Expand Down Expand Up @@ -74,7 +74,7 @@ jobs:
matrix:
tox-environment: [ "docker-tests", "lint", "docs", "generate" ]
name: ${{ matrix.tox-environment }}
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout Contrib Repo @ SHA - ${{ github.sha }}
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import requests
from opentelemetry.instrumentation.requests import RequestsInstrumentor
# You can optionally pass a custom TracerProvider to
RequestsInstrumentor.instrument()
# You can optionally pass a custom TracerProvider to instrument().
RequestsInstrumentor().instrument()
response = requests.get(url="https://www.example.org/")
API
Expand Down
24 changes: 19 additions & 5 deletions tests/opentelemetry-docker-tests/tests/check_availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,27 @@ def check_redis_connection():
connection.hgetall("*")


@retryable
def check_mssql_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={MSSQL_DB_NAME};UID={MSSQL_USER};"
f"PWD={MSSQL_PASSWORD}"
f"{MSSQL_PORT};DATABASE=master;UID={MSSQL_USER};"
f"PWD={MSSQL_PASSWORD}",
autocommit=True,
)
connection.close()
return connection


@retryable
def check_mssql_connection():
conn = new_mssql_connection()
conn.close()


def setup_mssql_db():
conn = new_mssql_connection()
cur = conn.cursor()
cur.execute(f"CREATE DATABASE [{MSSQL_DB_NAME}]")
conn.close()


def check_docker_services_availability():
Expand All @@ -127,6 +140,7 @@ def check_docker_services_availability():
check_postgres_connection()
check_redis_connection()
check_mssql_connection()
setup_mssql_db()


check_docker_services_availability()
4 changes: 2 additions & 2 deletions tests/opentelemetry-docker-tests/tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ services:
- "14268:14268"
- "9411:9411"
otmssql:
image: mcr.microsoft.com/mssql/server:2017-latest
image: mcr.microsoft.com/mssql/server:2017-CU23-ubuntu-16.04
ports:
- "1433:1433"
environment:
ACCEPT_EULA: "Y"
SA_PASSWORD: "yourStrong(!)Password"
command: /bin/sh -c "sleep 10s && /opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P yourStrong\(!\)Password -d master -Q 'CREATE DATABASE [opentelemetry-tests]' & /opt/mssql/bin/sqlservr"
command: /opt/mssql/bin/sqlservr

0 comments on commit f55d582

Please sign in to comment.