/
test.sh
executable file
·74 lines (60 loc) · 1.74 KB
/
test.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
# Audius Discovery Provider / Test
# Runs configured unit test scripts
# NOTE - the ipfs compose files have been moved from discprov to libs.
# Before running this test locally, bring up ipfs pod with libs/scripts/ipfs.sh
source ./scripts/utilities.sh
if [ ! -f .gitignore ]; then
echo "Run test script from audius discovery provider root"
exit
fi
set -e
# initialize virtual environment
# rm -r venv
# python3 -m venv venv
# source venv/bin/activate
pip3 install -r requirements.txt
sleep 5
set +e
# Reset local blockchain for deterministic test results
cd_contracts_repo
npm run ganache-q
npm run ganache
sleep 5
node_modules/.bin/truffle migrate
node_modules/.bin/truffle exec scripts/_contractsLocalSetup.js -run
cd_eth_contracts_repo
npm run ganache-q
npm run ganache
sleep 5
node_modules/.bin/truffle migrate
export audius_eth_contracts_registry=$(node -p "require('./migrations/migration-output.json').registryAddress")
export audius_web3_eth_provider_url=http://localhost:8546
cd_discprov_repo
# Stop dependencies, if present
docker network rm audius_dev
docker-compose \
-f compose/docker-compose.db.yml \
-f compose/docker-compose.redis.yml \
-f compose/docker-compose.ipfs.yml \
--env-file compose/.test.env \
stop
docker-compose \
-f compose/docker-compose.db.yml \
-f compose/docker-compose.redis.yml \
-f compose/docker-compose.ipfs.yml \
--env-file compose/.test.env \
rm -rf
# Bring up local dependencies - postgres, redis, ipfs
docker network create audius_dev
docker-compose \
-f compose/docker-compose.db.yml \
-f compose/docker-compose.redis.yml \
-f compose/docker-compose.ipfs.yml \
--env-file compose/.test.env \
up -d
sleep 5
# Unit tests
pytest src
# Integration tests
pytest integration_tests