From 831b3d057437cbd07592031614b484075ecf8a5c Mon Sep 17 00:00:00 2001 From: SaReN Date: Wed, 26 Aug 2020 15:51:15 +0530 Subject: [PATCH] Fix liveness test (#7095) Co-authored-by: Jonathan Gimeno Co-authored-by: Alessio Treglia Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com> --- .github/workflows/test.yml | 4 ++-- Makefile | 4 ++-- contrib/localnet_liveness.sh | 4 ++-- docker-compose.yml | 26 +++++++++++++++----------- 4 files changed, 21 insertions(+), 17 deletions(-) mode change 100644 => 100755 contrib/localnet_liveness.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 388d5df69..8afd74132 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 != ''" \ No newline at end of file + if: "env.GIT_DIFF != ''" diff --git a/Makefile b/Makefile index 447925e3c..94b2b8f9c 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/contrib/localnet_liveness.sh b/contrib/localnet_liveness.sh old mode 100644 new mode 100755 index 1dac38fa7..90c02e1a6 --- a/contrib/localnet_liveness.sh +++ b/contrib/localnet_liveness.sh @@ -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}" diff --git a/docker-compose.yml b/docker-compose.yml index cebdefdca..56e1fbff3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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