-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from DalgoT4D/39-test-cases-for-dbt-automation
39 test cases for dbt automation
- Loading branch information
Showing
40 changed files
with
2,342 additions
and
157 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[run] | ||
omit=tests/* | ||
*/__init__.py | ||
setup.py | ||
seeds/* | ||
scripts/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: DBT Automation Package | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
tests: | ||
env: | ||
TEST_PG_DBHOST: ${{ secrets.TEST_PG_DBHOST }} | ||
TEST_PG_DBPORT: ${{ secrets.TEST_PG_DBPORT }} | ||
TEST_PG_DBUSER: ${{ secrets.TEST_PG_DBUSER }} | ||
TEST_PG_DBPASSWORD: ${{ secrets.TEST_PG_DBPASSWORD }} | ||
TEST_PG_DBNAME: ${{ secrets.TEST_PG_DBNAME }} | ||
TEST_PG_DBSCHEMA_SRC: ${{ secrets.TEST_PG_DBSCHEMA_SRC }} | ||
|
||
TEST_BG_SERVICEJSON: ${{ secrets.TEST_BG_SERVICEJSON }} | ||
TEST_BG_LOCATION: ${{ secrets.TEST_BG_LOCATION }} | ||
TEST_BG_DATASET_SRC: ${{ secrets.TEST_BG_DATASET_SRC }} | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Create known_hosts file | ||
run: | | ||
mkdir -p ~/.ssh | ||
touch ~/.ssh/known_hosts | ||
- name: Add remote host key to known_hosts | ||
run: ssh-keyscan ${{ secrets.SSH_SERVERIP }} >> ~/.ssh/known_hosts | ||
|
||
- name: Login to the jump server and port forward to connect to the postgres warehouse | ||
run: | | ||
eval `ssh-agent -s` | ||
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}" | ||
ssh -L 5432:${{ secrets.SSH_HOST }}:5432 -f -N ddp@${{ secrets.SSH_SERVERIP }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
python setup.py install | ||
- name: Seed data in test warehouse | ||
run: | | ||
python seeds/seed.py --warehouse postgres | ||
python seeds/seed.py --warehouse bigquery | ||
- name: Run tests and collect coverage | ||
run: | | ||
pytest -s --cov=. | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
fail_ci_if_error: true | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
DBHOST= | ||
DBPORT= | ||
DBUSER= | ||
DBPASSWORD= | ||
DBNAME= | ||
|
||
DBT_PROJECT_DIR= | ||
|
||
# for bigquery | ||
GOOGLE_APPLICATION_CREDENTIALS=<path_to_service_account_json_creds_file> | ||
BIQUERY_LOCATION=<location of the project> | ||
|
||
# sample data seed credentials | ||
# postgres | ||
TEST_PG_DBHOST= | ||
TEST_PG_DBPORT= | ||
TEST_PG_DBUSER= | ||
TEST_PG_DBPASSWORD= | ||
TEST_PG_DBNAME= | ||
TEST_PG_DBSCHEMA_SRC= | ||
|
||
# bigquery | ||
TEST_BG_SERVICEJSON= | ||
TEST_BG_LOCATION= | ||
TEST_BG_DATASET_SRC= |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.