Skip to content
Permalink
Browse files

Merge branch 'backend-deploy-and-test'

  • Loading branch information...
martinboehm committed Feb 27, 2019
2 parents 6685471 + 22e73c4 commit 87b778d648690ee4ec9a911c01ca1af297ee1384
@@ -1,6 +1,7 @@
stages:
- build
- test
- backend-deploy-and-test

build:
stage: build
@@ -25,3 +26,113 @@ integration-test:
tags:
- blockbook
script: make test-integration ARGS="-run='TestIntegration/(bcash|bgold|bitcoin|dash|dogecoin|litecoin|vertcoin|zcash)=main/'"

backend-deploy-and-test-bcash:
stage: backend-deploy-and-test
only:
refs:
- master
changes:
- configs/coins/bcash.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh bcash

backend-deploy-and-test-bgold:
stage: backend-deploy-and-test
only:
refs:
- master
changes:
- configs/coins/bgold.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh bgold

backend-deploy-and-test-bitcoin:
stage: backend-deploy-and-test
only:
refs:
- master
changes:
- configs/coins/bitcoin.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh bitcoin

backend-deploy-and-test-dash:
stage: backend-deploy-and-test
only:
refs:
- master
changes:
- configs/coins/dash.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh dash

backend-deploy-and-test-dogecoin:
stage: backend-deploy-and-test
only:
refs:
- master
changes:
- configs/coins/dogecoin.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh dogecoin

backend-deploy-and-test-litecoin:
stage: backend-deploy-and-test
only:
refs:
- master
changes:
- configs/coins/litecoin.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh litecoin

backend-deploy-and-test-vertcoin:
stage: backend-deploy-and-test
only:
refs:
- master
changes:
- configs/coins/vertcoin.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh vertcoin

backend-deploy-and-test-zcash:
stage: backend-deploy-and-test
only:
refs:
- master
changes:
- configs/coins/zcash.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh zcash

backend-deploy-and-test-bitcoin_testnet:
stage: backend-deploy-and-test
only:
refs:
- master
changes:
- configs/coins/bitcoin_testnet.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh bitcoin_testnet bitcoin-testnet bitcoin=test testnet3/debug.log

backend-deploy-and-test-ethereum_testnet_ropsten:
stage: backend-deploy-and-test
only:
refs:
- master
changes:
- configs/coins/ethereum_testnet_ropsten.json
tags:
- blockbook
script: ./contrib/scripts/backend-deploy-and-test.sh ethereum_testnet_ropsten ethereum-testnet-ropsten ethereum=test ethereum_testnet_ropsten.log
@@ -0,0 +1,33 @@
#!/bin/bash

if [ $# -ne 1 ] && [ $# -ne 4 ]
then
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
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-${SERVICE}*.deb)
[ -z "${PACKAGE}" ] && echo "Package not found" && exit 1

sudo /usr/bin/dpkg -i "${PACKAGE}" || exit 1
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}"
@@ -37,6 +37,7 @@ type TestData struct {
BlockHeight uint32 `json:"blockHeight"`
BlockHash string `json:"blockHash"`
BlockTime int64 `json:"blockTime"`
BlockSize int `json:"blockSize"`
BlockTxs []string `json:"blockTxs"`
TxDetails map[string]*bchain.Tx `json:"txDetails"`
}
@@ -314,6 +315,7 @@ func testGetBlockHeader(t *testing.T, h *TestHandler) {
Hash: h.TestData.BlockHash,
Height: h.TestData.BlockHeight,
Time: h.TestData.BlockTime,
Size: h.TestData.BlockSize,
}

got, err := h.Chain.GetBlockHeader(h.TestData.BlockHash)
@@ -2,6 +2,7 @@
"blockHeight": 2870000,
"blockHash": "0xeccd6b0031015a19cb7d4e10f28590ba65a6a54ad1baa322b50fe5ad16903895",
"blockTime": 1521515026,
"blockSize": 2729,
"blockTxs": [
"0x17ee235fc0359155b25419e0e4c65d9c500df6e71e8288d6ef020d04cc2f2cb3",
"0xe6b168d6bb3d8ed78e03dbf828b6bfd1fb613f6e129cba624964984553724c5d",
@@ -18,7 +19,6 @@
],
"txDetails": {
"0x7f0d140329941f120b5b3fc751e30adeb87b2aebbfce5adcd0216604a34b6cc0": {
"hex": "7b226e6f6e6365223a223078333632306136222c226761735072696365223a223078313261303566323030222c22676173223a22307835323038222c22746f223a22307831623137626331326166623635643563346238316139666632613037366234326131396661616136222c2276616c7565223a223078646530623662336137363430303030222c22696e707574223a223078222c2268617368223a22307837663064313430333239393431663132306235623366633735316533306164656238376232616562626663653561646364303231363630346133346236636330222c22626c6f636b4e756d626572223a223078326263616630222c2266726f6d223a22307838316237653038663635626466353634383630366338393939386139636338313634333937363437222c227472616e73616374696f6e496e646578223a22307862222c2276223a2230783162222c2272223a22307862666662323864633865373939383833366639356664616139396433626435666635346365663562313839636462383537333537666161326431616231393136222c2273223a22307833616462316365313264396664306538616662373064386639346534636538356137666639346465333966623636333139363638363435663464643138646432227d",
"txid": "0x7f0d140329941f120b5b3fc751e30adeb87b2aebbfce5adcd0216604a34b6cc0",
"blocktime": 1521515026,
"time": 1521515026,

0 comments on commit 87b778d

Please sign in to comment.
You can’t perform that action at this time.