Skip to content

Commit

Permalink
Run localnet on every commit ensure network reaches at least 10 blocks (
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzampolin authored and cwgoes committed Aug 16, 2018
1 parent 3d50567 commit 45bd414
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 12 deletions.
26 changes: 26 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -185,6 +208,9 @@ workflows:
- test_cover:
requires:
- setup_dependencies
- localnet:
requires:
- setup_dependencies
- upload_coverage:
requires:
- test_cover
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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:
Expand Down
19 changes: 9 additions & 10 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,9 +22,9 @@ FEATURES

* Gaia

* SDK
* SDK

* Tendermint
* Tendermint


IMPROVEMENTS
Expand All @@ -35,9 +35,9 @@ IMPROVEMENTS

* Gaia

* SDK
* SDK

* Tendermint
* Tendermint


BUG FIXES
Expand All @@ -48,7 +48,6 @@ BUG FIXES

* Gaia

* SDK

* Tendermint
* SDK

* Tendermint
41 changes: 41 additions & 0 deletions scripts/localnet-blocks-test.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 45bd414

Please sign in to comment.