Add service name to backend deploy and integration test

pull/131/head
Martin Boehm 2019-02-25 18:40:12 +01:00
parent 9382c7a9c0
commit bcd4b8ed4f
2 changed files with 16 additions and 10 deletions

View File

@ -36,7 +36,7 @@ backend-deploy-and-test-bitcoin:
- configs/coins/bitcoin.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh bitcoin bitcoin=main debug.log
script: ./contrib/scripts/backend-deploy-and-test.sh bitcoin
backend-deploy-and-test-bitcoin_testnet:
stage: backend-deploy-and-test
@ -47,4 +47,4 @@ backend-deploy-and-test-bitcoin_testnet:
- configs/coins/bitcoin_testnet.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh bitcoin_testnet bitcoin=test testnet3/debug.log
script: ./contrib/scripts/backend-deploy-and-test.sh bitcoin_testnet bitcoin-testnet bitcoin=test testnet3/debug.log

View File

@ -1,27 +1,33 @@
#!/bin/bash
if [ $# -lt 1 ]
if [ $# -ne 1 ] && [ $# -ne 4 ]
then
echo "Usage: $(basename $(readlink -f $0)) coin [coin_test] [backend log file]" 1>&2
echo -e "Usage:\n\n$(basename $(readlink -f $0)) coin service_name coin_test backend_log_file\n\nor\n\n$(basename $(readlink -f $0)) coin\nin which case service_name, coin_test and backend_log_file are derived from coin or default" 1>&2
exit 1
fi
COIN=$1
COIN_TEST=$2
LOGFILE=$3
SERVICE=$2
COIN_TEST=$3
LOGFILE=$4
[ -z "${BACKEND_TIMEOUT}" ] && BACKEND_TIMEOUT=15s
[ -z "${SERVICE}" ] && SERVICE="${COIN}"
[ -z "${COIN_TEST}" ] && COIN_TEST="${COIN}=main"
[ -z "${LOGFILE}" ] && LOGFILE=debug.log
echo "Running: $(basename $(readlink -f $0)) ${COIN} ${SERVICE} ${COIN_TEST} ${LOGFILE}"
rm build/*.deb
make "deb-backend-${COIN}"
PACKAGE=$(ls "./build/backend-${COIN}*.deb")
PACKAGE=$(ls ./build/backend-${SERVICE}*.deb)
[ -z "${PACKAGE}" ] && echo "Package not found" && exit 1
sudo /usr/bin/dpkg -i "${PACKAGE}" || exit 1
sudo /bin/systemctl restart "backend-${COIN}" || exit 1
timeout ${BACKEND_TIMEOUT} tail -f "/opt/coins/data/${COIN}/backend/${LOGFILE}"
make test-integration ARGS="-v -run=TestIntegration/${COIN_TEST}"
sudo /bin/systemctl restart "backend-${SERVICE}" || exit 1
echo "Waiting for backend startup for ${BACKEND_TIMEOUT}"
timeout ${BACKEND_TIMEOUT} tail -f "/opt/coins/data/${COIN}/backend/${LOGFILE}"
make test-integration ARGS="-v -run=TestIntegration/${COIN_TEST}"