Skip to content

Commit

Permalink
fix(#156): unit test fixture not found when integrating with cht-sync (
Browse files Browse the repository at this point in the history
…#158)

* move fixture outside folder

* add test-paths

* add dbtignore file

* fix patient data test

* rename test folder to tests

* fix sonar failed conditions

---------

Co-authored-by: Maria Lorena Rodriguez Viruel <[email protected]>
  • Loading branch information
lorerod and Maria Lorena Rodriguez Viruel authored Sep 4, 2024
1 parent 535e33c commit ad88744
Show file tree
Hide file tree
Showing 37 changed files with 14 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .dbtignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# .dbtignore
init.sql
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
if: steps.get-docker-hub-username.outputs.dockerhub_username
- name: Run dbt and tests
run: ./run_dbt_tests.sh
working-directory: ./test
working-directory: ./tests
2 changes: 1 addition & 1 deletion dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ config-version: 2
# This setting configures which "profile" dbt uses for this project.
profile: 'default'

on-run-end:
on-run-end:
- "{{ log_dbt_results(results) }}"
File renamed without changes.
File renamed without changes.
18 changes: 8 additions & 10 deletions test/dbt/Dockerfile → tests/dbt/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
FROM python:3 AS testing

RUN pip install flake8

RUN flake8 dbt-run.py
RUN pip install flake8 \
&& flake8 dbt-run.py

FROM python:3 AS release

RUN pip install --upgrade cffi \
&& pip install cryptography~=3.4 \
&& pip install dbt-core dbt-postgres

RUN adduser dbt
&& pip install dbt-core dbt-postgres \
&& adduser dbt
USER dbt

WORKDIR /dbt/
COPY test/profiles.yml profiles.yml
COPY tests/profiles.yml profiles.yml
COPY dbt_project.yml dbt_project.yml
COPY packages.yml packages.yml
COPY models models
COPY macros macros
COPY test/fixtures tests/fixtures
COPY test/sqltest tests
COPY test/run_dbt_tests_docker.sh run_dbt_tests_docker.sh
COPY tests/fixtures tests/fixtures
COPY tests/sqltest tests
COPY tests/run_dbt_tests_docker.sh run_dbt_tests_docker.sh

CMD ["bash", "./run_dbt_tests_docker.sh"]
2 changes: 1 addition & 1 deletion test/docker-compose.yml → tests/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
dbt:
build:
context: ../
dockerfile: ./test/dbt/Dockerfile
dockerfile: ./tests/dbt/Dockerfile
environment:
- POSTGRES_HOST=postgres
- POSTGRES_USER=pipelinetest
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/sqltest/patient.sql → tests/sqltest/patient.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SELECT
FROM v1.couchdb couchdb
FROM {{ source('couchdb', env_var('POSTGRES_TABLE')) }} couchdb
LEFT JOIN {{ ref('patient') }} patient ON couchdb._id = patient.uuid
WHERE
couchdb._deleted = false
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit ad88744

Please sign in to comment.