-
Notifications
You must be signed in to change notification settings - Fork 13
/
run_tests.sh
executable file
·60 lines (42 loc) · 1.29 KB
/
run_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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
set -e
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
cd $SCRIPT_DIR
# Leaving the database file between runs of pytest can mess up subsequent test runs.
# Since this runs in a fresh container each time, it's not an issue.
pytest tests/functional $@
####
# dbt-sqlite overrides some stuff pertaining to 'docs generate'
# so exercise it using jaffle_shop repo
# dbt-sqlite overrides some stuff pertaining to 'docs generate'
# so exercise it using jaffle_shop repo
cd $HOME
git clone --depth 1 https://github.com/dbt-labs/jaffle_shop.git
cd jaffle_shop
mkdir -p /tmp/jaffle_shop
mkdir -p $HOME/.dbt
if [ -f $HOME/.dbt/profiles.yml ]; then
echo "ERROR: profiles.yml already exists, refusing to overwrite it"
exit 1
fi
cat >> $HOME/.dbt/profiles.yml <<EOF
jaffle_shop:
target: dev
outputs:
dev:
type: sqlite
threads: 1
# database MUST exist in order for macros to work. its value is arbitrary.
database: "database"
schema: 'main'
schemas_and_paths:
main: '/tmp/jaffle_shop/jaffle_shop.db'
schema_directory: '/tmp/jaffle_shop'
extensions:
- "/opt/dbt-sqlite/crypto.so"
- "/opt/dbt-sqlite/math.so"
- "/opt/dbt-sqlite/text.so"
EOF
dbt seed
dbt run
dbt docs generate