Skip to content

Commit

Permalink
Fix liveness test (cosmos#7095)
Browse files Browse the repository at this point in the history
Co-authored-by: Jonathan Gimeno <jgimeno@gmail.com>
Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
  • Loading branch information
4 people committed Aug 26, 2020
1 parent 7f59723 commit 831b3d0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,9 @@ jobs:
make build-docker-local-simapp
- name: start localnet
run: |
make clean build-sim-linux localnet-start
make clean localnet-start
if: "env.GIT_DIFF != ''"
- name: test liveness
run: |
./contrib/localnet_liveness.sh 100 5 50 localhost
if: "env.GIT_DIFF != ''"
if: "env.GIT_DIFF != ''"
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ build-docker-local-simapp:
docker build -t cosmos-sdk/simapp .

# Run a 4-node testnet locally
localnet-start: build-simd-linux localnet-stop
@if ! [ -f build/node0/simd/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/simd:Z cosmos-sdk/simappnode testnet --v 4 -o . --starting-ip-address 192.168.10.2 --keyring-backend=test ; fi
localnet-start: localnet-stop
@if ! [ -f build/node0/simd/config/genesis.json ]; then docker run --rm -v $(CURDIR)/build:/root:Z cosmos-sdk/simapp simd testnet --v 4 -o . --starting-ip-address 192.168.10.2 --keyring-backend=test ; fi
docker-compose up -d

localnet-stop:
Expand Down
4 changes: 2 additions & 2 deletions contrib/localnet_liveness.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ if [ -z "$4" ]; then
exit 1
fi

docker_containers=( $(docker ps -q -f name=simdnode --format='{{.Names}}') )
docker_containers=( $(docker ps -q -f name=simd --format='{{.Names}}') )

while [ ${CNT} -lt $ITER ]; do
curr_block=$(curl -s $NODEADDR:26657/status | jq -r '.result.sync_info.latest_block_height')
curr_block=$(curl -s $NODEADDR:26655/status | jq -r '.result.sync_info.latest_block_height')

if [ ! -z ${curr_block} ] ; then
echo "Number of Blocks: ${curr_block}"
Expand Down
26 changes: 15 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,64 +3,68 @@ version: "3"
services:
simdnode0:
container_name: simdnode0
image: "cosmos-sdk/simappnode"
image: "cosmos-sdk/simapp"
ports:
- "26656-26657:26656-26657"
- "1317:1317"
- "9090:9090"
- "26654-26655:26656-26657"
- "1316:1317"
- "9089:9090"
command: ["simd", "start"]
environment:
- ID=0
- LOG=${LOG:-simd.log}
volumes:
- ./build:/simd:Z
- ./build/node0/simd/:/root/.simapp:Z
networks:
localnet:
ipv4_address: 192.168.10.2

simdnode1:
container_name: simdnode1
image: "cosmos-sdk/simappnode"
image: "cosmos-sdk/simapp"
ports:
- "26659-26660:26656-26657"
- "1318:1317"
- "9091:9090"
command: ["simd", "start"]
environment:
- ID=1
- LOG=${LOG:-simd.log}
volumes:
- ./build:/simd:Z
- ./build/node1/simd/:/root/.simapp:Z
networks:
localnet:
ipv4_address: 192.168.10.3

simdnode2:
container_name: simdnode2
image: "cosmos-sdk/simappnode"
image: "cosmos-sdk/simapp"
environment:
- ID=2
- LOG=${LOG:-simd.log}
command: ["simd", "start"]
ports:
- "26661-26662:26656-26657"
- "1319:1317"
- "9092:9090"
volumes:
- ./build:/simd:Z
- ./build/node2/simd/:/root/.simapp:Z
networks:
localnet:
ipv4_address: 192.168.10.4

simdnode3:
container_name: simdnode3
image: "cosmos-sdk/simappnode"
image: "cosmos-sdk/simapp"
environment:
- ID=3
- LOG=${LOG:-simd.log}
command: ["simd", "start"]
ports:
- "26663-26664:26656-26657"
- "1320:1317"
- "9093:9090"
volumes:
- ./build:/simd:Z
- ./build/node3/simd/:/root/.simapp:Z
networks:
localnet:
ipv4_address: 192.168.10.5
Expand Down

0 comments on commit 831b3d0

Please sign in to comment.