Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sql-server tests for dbt 1.3.0 to 1.8.0 #445

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 84 additions & 1 deletion .github/workflows/ci_test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
strategy:
fail-fast: false # Don't fail one DWH if the others fail
matrix:
warehouse: ["snowflake", "bigquery", "postgres", "sqlserver"]
warehouse: ["snowflake", "bigquery", "postgres"]
# When supporting a new version, update the list here
version: ["1_3_0", "1_4_0", "1_5_0", "1_6_0", "1_7_0", "1_8_0"]
runs-on: ubuntu-latest
Expand Down Expand Up @@ -193,3 +193,86 @@ jobs:
# env:
# DBT_VERSION: ''
# run: tox -e integration_databricks

integration-sqlserver:
strategy:
fail-fast: false # Don't fail one DWH if the others fail
runs-on: ubuntu-latest
environment:
name: Approve Integration Tests

steps:
- uses: actions/setup-python@v4
with:
python-version: "3.8.x"
architecture: "x64"
- name: Install SQL Server
uses: Particular/[email protected]
with:
connection-string-env-var: SQL_SERVER_CONNECTION_STRING
catalog: dbt_artifact_integrationtests
- name: Create DBT User
shell: pwsh
run: |
echo "Create dbt login with sysadmin"
sqlcmd -Q "CREATE LOGIN dbt WITH PASSWORD = '123', CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF" -d "dbt_artifact_integrationtests"
sqlcmd -Q "ALTER SERVER ROLE sysadmin ADD MEMBER dbt" -d "dbt_artifact_integrationtests"

- name: Install tox
run: python3 -m pip install tox

- name: Install Microsoft ODBC
run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y

- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }} # Check out the code of the PR

- name: Run Tests on PR
env:
DBT_VERSION: ${{ matrix.version }}
run: tox -e integration_sqlserver

integration-sqlserver-single-run:
strategy:
fail-fast: false # Don't fail one DWH if the others fail
matrix:
# When supporting a new version, update the list here
version: ["1_3_0", "1_4_0", "1_7_0", "1_8_0"]
michelley-an marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest
environment:
name: Approve Integration Tests

steps:
- uses: actions/setup-python@v4
with:
python-version: "3.8.x"
architecture: "x64"
- name: Install SQL Server
uses: Particular/[email protected]
with:
connection-string-env-var: SQL_SERVER_CONNECTION_STRING
catalog: dbt_artifact_integrationtests
- name: Create DBT User
shell: pwsh
run: |
echo "Create dbt login with sysadmin"
sqlcmd -Q "CREATE LOGIN dbt WITH PASSWORD = '123', CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF" -d "dbt_artifact_integrationtests"
sqlcmd -Q "ALTER SERVER ROLE sysadmin ADD MEMBER dbt" -d "dbt_artifact_integrationtests"

- name: Install tox
run: python3 -m pip install tox

- name: Install Microsoft ODBC
run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y

- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }} # Check out the code of the PR

- name: Run Tests on PR
env:
DBT_VERSION: ${{ matrix.version }}
michelley-an marked this conversation as resolved.
Show resolved Hide resolved
run: tox -e integration_sqlserver_${{ matrix.version }}
52 changes: 45 additions & 7 deletions .github/workflows/main_test_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
integration:
strategy:
matrix:
warehouse: ["snowflake", "bigquery", "postgres", "sqlserver"]
warehouse: ["snowflake", "bigquery", "postgres"]
version: ["1_3_0", "1_4_0", "1_5_0", "1_6_0", "1_7_0", "1_8_0"]
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -66,12 +66,6 @@ jobs:
- name: Install tox
run: python3 -m pip install tox

- name: Install SQL Server
run: docker run -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=123" -p 1433:1433 -d mcr.microsoft.com/mssql/server:2022-latest

- name: Install Microsoft ODBC
run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y

- id: auth
if: ${{ matrix.warehouse == 'bigquery' }}
uses: google-github-actions/auth@v1
Expand Down Expand Up @@ -102,3 +96,47 @@ jobs:

# - name: Run Databricks Tests
# run: tox -e integration_databricks

integration-sqlserver:
strategy:
fail-fast: false # Don't fail one DWH if the others fail
matrix:
# When supporting a new version, update the list here
version: ["1_3_0", "1_4_0", "1_7_0", "1_8_0"]
runs-on: ubuntu-latest
environment:
name: Approve Integration Tests

steps:
- uses: actions/setup-python@v4
with:
python-version: "3.8.x"
architecture: "x64"
- name: Install SQL Server
uses: Particular/[email protected]
with:
connection-string-env-var: SQL_SERVER_CONNECTION_STRING
catalog: dbt_artifact_integrationtests
- name: Create DBT User
shell: pwsh
run: |
echo "Create dbt login with sysadmin"
sqlcmd -Q "CREATE LOGIN dbt WITH PASSWORD = '123', CHECK_POLICY = OFF, CHECK_EXPIRATION = OFF" -d "dbt_artifact_integrationtests"
sqlcmd -Q "ALTER SERVER ROLE sysadmin ADD MEMBER dbt" -d "dbt_artifact_integrationtests"

- name: Install tox
run: python3 -m pip install tox

- name: Install Microsoft ODBC
run: sudo ACCEPT_EULA=Y apt-get install msodbcsql18 -y

- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }} # Check out the code of the PR

- name: Run Tests on PR
env:
DBT_VERSION: ${{ matrix.version }}
run: tox -e integration_sqlserver_${{ matrix.version }}

2 changes: 1 addition & 1 deletion integration_test_project/profiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@ dbt_artifacts:
schema: dbo
windows_login: False
trust_cert: True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
trust_cert: True
trust_cert: True
Encrypt: False

user: sa
user: dbt
password: "123"
michelley-an marked this conversation as resolved.
Show resolved Hide resolved
22 changes: 15 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -355,31 +355,39 @@ commands =

[testenv:integration_sqlserver]
changedir = integration_test_project
deps = dbt-sqlserver~=1.8.4
deps = dbt-sqlserver~=1.8.0
commands =
dbt clean
dbt deps
dbt build --target sqlserver

[testenv:integration_sqlserver_1_4_3]
[testenv:integration_sqlserver_1_3_0]
changedir = integration_test_project
deps = dbt-sqlserver~=1.4.3
deps = dbt-sqlserver~=1.3.0
commands =
dbt clean
dbt deps
dbt build --target sqlserver

[testenv:integration_sqlserver_1_7_4]
[testenv:integration_sqlserver_1_4_0]
changedir = integration_test_project
deps = dbt-sqlserver~=1.7.4
deps = dbt-sqlserver~=1.4.0
commands =
dbt clean
dbt deps
dbt build --target sqlserver

[testenv:integration_sqlserver_1_8_4]
[testenv:integration_sqlserver_1_7_0]
changedir = integration_test_project
deps = dbt-sqlserver~=1.8.4
deps = dbt-sqlserver~=1.7.0
commands =
dbt clean
dbt deps
dbt build --target sqlserver

[testenv:integration_sqlserver_1_8_0]
changedir = integration_test_project
deps = dbt-sqlserver~=1.8.0
commands =
dbt clean
dbt deps
Expand Down
Loading