Run localnet on every commit ensure network reaches at least 10 blocks (#2067)

This commit is contained in:
Jack Zampolin 2018-08-16 11:23:57 -07:00 committed by Christopher Goes
parent 3d50567034
commit 45bd414fc2
5 changed files with 79 additions and 12 deletions

View File

@ -165,6 +165,29 @@ jobs:
name: upload
command: bash <(curl -s https://codecov.io/bash) -f coverage.txt
localnet:
working_directory: /home/circleci/.go_workspace/src/github.com/cosmos/cosmos-sdk
machine:
image: circleci/classic:latest
environment:
GOBIN: /home/circleci/.go_workspace/bin
GOPATH: /home/circleci/.go_workspace/
GOOS: linux
GOARCH: amd64
parallelism: 1
steps:
- checkout
- run:
name: run localnet and exit on failure
command: |
set -x
make get_tools
make get_vendor_deps
make build-linux
make localnet-start
./scripts/localnet-blocks-test.sh 40 5 10 localhost
workflows:
version: 2
test-suite:
@ -185,6 +208,9 @@ workflows:
- test_cover:
requires:
- setup_dependencies
- localnet:
requires:
- setup_dependencies
- upload_coverage:
requires:
- test_cover

View File

@ -84,6 +84,7 @@ IMPROVEMENTS
- [x/gov] Initial governance parameters can now be set in the genesis file
- [x/stake] \#1815 Sped up the processing of `EditValidator` txs.
- [config] \#1930 Transactions indexer indexes all tags by default.
- [ci] [#2057](https://github.com/cosmos/cosmos-sdk/pull/2057) Run `make localnet-start` on every commit and ensure network reaches at least 10 blocks
* SDK
- [baseapp] \#1587 Allow any alphanumeric character in route

View File

@ -15,7 +15,7 @@ ci: get_tools get_vendor_deps install test_cover test_lint test
########################################
### Build/Install
check-ledger:
check-ledger:
ifeq ($(LEDGER_ENABLED),true)
ifndef GCC
$(error "gcc not installed for ledger support, please install")
@ -193,7 +193,7 @@ build-docker-gaiadnode:
# Run a 4-node testnet locally
localnet-start: localnet-stop
@if ! [ -f build/node0/gaiad/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/gaiad:Z tendermint/gaiadnode testnet --v 4 --o . --starting-ip-address 192.168.10.2 ; fi
docker-compose up
docker-compose up -d
# Stop testnet
localnet-stop:

View File

@ -8,10 +8,10 @@ BREAKING CHANGES
* Gaia
* Make the transient store key use a distinct store key. [#2013](https://github.com/cosmos/cosmos-sdk/pull/2013)
* SDK
* Tendermint
* SDK
* Tendermint
FEATURES
@ -22,9 +22,9 @@ FEATURES
* Gaia
* SDK
* SDK
* Tendermint
* Tendermint
IMPROVEMENTS
@ -35,9 +35,9 @@ IMPROVEMENTS
* Gaia
* SDK
* SDK
* Tendermint
* Tendermint
BUG FIXES
@ -48,7 +48,6 @@ BUG FIXES
* Gaia
* SDK
* Tendermint
* SDK
* Tendermint

41
scripts/localnet-blocks-test.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
CNT=0
ITER=$1
SLEEP=$2
NUMBLOCKS=$3
NODEADDR=$4
if [ -z "$1" ]; then
echo "Need to input number of iterations to run..."
exit 1
fi
if [ -z "$2" ]; then
echo "Need to input number of seconds to sleep between iterations"
exit 1
fi
if [ -z "$3" ]; then
echo "Need to input block height to declare completion..."
exit 1
fi
if [ -z "$4" ]; then
echo "Need to input node address to poll..."
exit 1
fi
while [ ${CNT} -lt $ITER ]; do
var=$(curl -s $NODEADDR:26657/status | jq -r '.result.sync_info.latest_block_height')
echo "Number of Blocks: ${var}"
if [ ! -z ${var} ] && [ ${var} -gt ${NUMBLOCKS} ]; then
echo "Number of blocks reached, exiting success..."
exit 0
fi
let CNT=CNT+1
sleep $SLEEP
done
echo "Timeout reached, exiting failure..."
exit 1