-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ganache to docker-compose file, use it in the run-tests.sh script (…
- Loading branch information
Showing
2 changed files
with
8 additions
and
26 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
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 |
---|---|---|
@@ -1,32 +1,9 @@ | ||
#!/bin/sh | ||
# Postgresql and ganache-cli must be running for the tests | ||
|
||
ps aux | grep ganache-cli | grep -v grep > /dev/null | ||
if [ $? -eq 1 ]; then | ||
echo 'Running Ganache-Cli' | ||
ganache-cli --defaultBalanceEther 10000 --gasLimit 10000000 -a 30 --chain.chainId 1337 --chain.networkId 1337 -d > /dev/null & | ||
GANACHE_PID=$! | ||
sleep 3 | ||
fi | ||
|
||
docker ps | grep '\->5432' > /dev/null | ||
if [ $? -eq 1 ]; then | ||
docker-compose up -d db | ||
sleep 3 | ||
DATABASE_UP=1 | ||
else | ||
DATABASE_UP=0 | ||
fi | ||
|
||
docker-compose up -d db ganache | ||
sleep 3 | ||
|
||
# python manage.py test --settings=config.settings.test | ||
DJANGO_SETTINGS_MODULE=config.settings.test pytest | ||
|
||
if [ ${GANACHE_PID:-0} -gt 1 ]; then | ||
echo 'Killing opened Ganache-Cli' | ||
kill $GANACHE_PID | ||
fi | ||
|
||
if [ $DATABASE_UP -eq 1 ]; then | ||
docker-compose down | ||
fi | ||
docker-compose down |