Fix liveness test (#7095)

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>
This commit is contained in:
SaReN 2020-08-26 15:51:15 +05:30 committed by GitHub
parent 7f59723d88
commit 831b3d0574
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 17 deletions

View File

@ -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 != ''"

View File

@ -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:

4
contrib/localnet_liveness.sh Normal file → Executable file
View File

@ -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}"

View File

@ -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