Skip to content

Commit

Permalink
Merge pull request #75 from dbt-msft/cnxn_ci
Browse files Browse the repository at this point in the history
Add CI tests for different target connection configs
  • Loading branch information
mikaelene authored Jan 5, 2021
2 parents d459b95 + ec33415 commit a7f0a23
Show file tree
Hide file tree
Showing 5 changed files with 97 additions and 2 deletions.
45 changes: 44 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ orbs:
python: circleci/[email protected]

jobs:
integration-sqlserver:
integration-sqlserver: &sqlserver
docker:
- image: dataders/pyodbc:1.4
- image: mcr.microsoft.com/mssql/server:2019-latest
Expand All @@ -26,6 +26,46 @@ jobs:
- run:
name: Test adapter on SQL Server against dbt-adapter-tests
command: tox -e integration-sqlserver
connection-sqlserver:
<<: *sqlserver
steps:
- checkout
- python/install-packages:
pkg-manager: pip
- run:
name: wait for SQL Server container to set up
command: sleep 30
- run:
name: prep for connecting
command: |
mkdir -p ~/.dbt
cd test/integration
cp sample.profiles.yml ~/.dbt/profiles.yml
- run:
name: cnxn -- SQL Server - local sql cred
command: |
cd test/integration
dbt compile --target sqlserver_local_userpass
- run:
name: cnxn -- SQL Server - local sql cred encrypt
command: |
cd test/integration
dbt compile --target sqlserver_local_encrypt
- run:
name: cnxn -- Azure SQL - SQL cred
command: |
cd test/integration
dbt compile --target azuresql_sqlcred
# TODO drop support for this method in favor of
# https://github.com/dbt-msft/dbt-sqlserver/pull/71
# - run:
# name: cnxn -- Azure SQL - AAD Password
# command: |
# cd test/integration
# dbt compile --target azuresql_aad

integration-azuresql:
docker:
- image: dataders/pyodbc:1.4
Expand All @@ -41,6 +81,9 @@ jobs:
workflows:
main:
jobs:
- connection-sqlserver:
context:
- DBT_SYNAPSE_PROFILE
- integration-sqlserver
- integration-azuresql:
context:
Expand Down
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ black~=20.8b1
pytest-dbt-adapter~=0.3.0
tox==3.2.0
flake8>=3.5.0
certifi==2020.6.20
certifi==2020.6.20
.
6 changes: 6 additions & 0 deletions test/integration/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

name: 'sqlserver_integration_tests'
version: '1.0'
config-version: 2

profile: 'integration_tests'
3 changes: 3 additions & 0 deletions test/integration/models/test.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{# inane comment #}
{% set col_name = 'foo' %}
SELECT 1 as {{ col_name }}
42 changes: 42 additions & 0 deletions test/integration/sample.profiles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# HEY! This file is used in the tsql_utils integrations tests with CircleCI.
# You should __NEVER__ check credentials into version control. Thanks for reading :)

config:
send_anonymous_usage_stats: False
use_colors: True

defaults:
sqlserver: &sqlserver
type: sqlserver
driver: "ODBC Driver 17 for SQL Server"
schema: "dbt_cnxn_test"
port: 1433
threads: 8

integration_tests:
target: sqlserver_local_userpass
outputs:
sqlserver_local_userpass: &sqlserver-local
<<: *sqlserver
host: localhost
database: msdb
username: SA
password: 5atyaNadella
sqlserver_local_encrypt:
<<: *sqlserver-local
encrypt: yes
trust_cert: yes
azuresql_sqlcred: &azuresql
<<: *sqlserver
host: "{{ env_var('DBT_AZURESQL_SERVER') }}"
database: "{{ env_var('DBT_AZURESQL_DB') }}"
username: "{{ env_var('DBT_AZURESQL_UID') }}"
password: "{{ env_var('DBT_AZURESQL_PWD') }}"
encrypt: yes
trust_cert: yes
azuresql_aad:
<<: *azuresql
authentication: ActiveDirectoryPassword
username: "{{ env_var('DBT_AZURESQL_AAD_USER') }}"
password: "{{ env_var('DBT_AZURESQL_AAD_PASS') }}"

0 comments on commit a7f0a23

Please sign in to comment.