forked from EqualExperts/dbt-unit-testing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-integration-tests.sh
executable file
·40 lines (29 loc) · 1.06 KB
/
run-integration-tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
set -e
if [ -z "$1" ]; then
echo 'Please provide profile name'
exit 1
fi
if [ -z "$2" ]; then
echo 'Please provide dbt version'
exit 1
fi
PROFILE=$1
cd integration-tests || exit
if [[ ! -e ~/.dbt/profiles.yml ]]; then
mkdir -p ~/.dbt
cp ci/profiles.yml ~/.dbt/profiles.yml
fi
dbt deps --target "$PROFILE"
dbt run-operation macro_with_ref --target "$PROFILE"
# create seeds in the database
dbt seed --target "$PROFILE" --select seeds/real_seeds
# run tests with no database dependency
dbt test --target "$PROFILE" --select tag:unit-test,tag:"$PROFILE" --exclude tag:versioned tag:db-dependency
dbt test --target "$PROFILE" --select tag:unit-test,tag:"$PROFILE",tag:"$DBT_VERSION" --exclude tag:db-dependency
# create sources in the database
dbt seed --target "$PROFILE" --select seeds/existing_sources
# create models in the database for tests that depends on database models
dbt run --target "$PROFILE" --select tag:add-to-database
# run tests with database dependency
dbt test --target "$PROFILE" --select tag:unit-test,tag:"$PROFILE",tag:db-dependency