From 46aeeb30890ba8e2575e0d566024f3f39cc64ff2 Mon Sep 17 00:00:00 2001 From: n0izn0iz Date: Thu, 18 Jan 2024 15:40:51 +0100 Subject: [PATCH] feat: basic integration test (#82) * feat: basic integration test Signed-off-by: Norman Meier * fix: no broadcast-mode block Signed-off-by: Norman Meier * chore: split commit Signed-off-by: Norman Meier --------- Signed-off-by: Norman Meier --- .github/workflows/integration.yml | 24 ++++++++++++++++++++++++ .gitignore | 4 +++- Makefile | 4 ++++ README.md | 8 ++++++++ integration-test/run.sh | 8 ++++++++ integration-test/test.sh | 21 +++++++++++++++++++++ 6 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/integration.yml create mode 100755 integration-test/run.sh create mode 100755 integration-test/test.sh diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml new file mode 100644 index 0000000..7dae33f --- /dev/null +++ b/.github/workflows/integration.yml @@ -0,0 +1,24 @@ +name: Integration + +on: + push: + branches: + - main + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-go@v3 + with: + go-version: "1.20" + + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - name: Run integration test + run: make integration-test diff --git a/.gitignore b/.gitignore index bdb697f..168bfb1 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ testnetv2 data *.txt -.idea \ No newline at end of file +.idea + +/teritori-dapp/ \ No newline at end of file diff --git a/Makefile b/Makefile index dbb37c6..e97c05e 100644 --- a/Makefile +++ b/Makefile @@ -213,3 +213,7 @@ proto-check-breaking: docker.publish: docker build . --platform linux/amd64 -t $(IMAGE_TAG) docker push $(IMAGE_TAG) + +.PHONY: integration-test +integration-test: + ./integration-test/run.sh \ No newline at end of file diff --git a/README.md b/README.md index 8f18918..15aa9ea 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,11 @@ Teritori is a Cosmos SDK based blockchain here to enhance Web3 individuals, comm ## All the mainnet chains: [__ACTIVE__] - [teritori-1](https://github.com/TERITORI/teritori-chain/tree/main/mainnet/teritori-1) + +# Dev + +## Run custom integration test + +```shell +TERITORI_DAPP_REPO=/path/to/teritori-dapp ./integration-test/run.sh +``` \ No newline at end of file diff --git a/integration-test/run.sh b/integration-test/run.sh new file mode 100755 index 0000000..f37ca5e --- /dev/null +++ b/integration-test/run.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -euo pipefail +IFS=$'\n\t' +set -x + +make install + +parallel --lb -j2 --halt now,done=1 ::: './start.sh >> node_logs.txt 2>&1' './integration-test/test.sh' \ No newline at end of file diff --git a/integration-test/test.sh b/integration-test/test.sh new file mode 100755 index 0000000..2ad285b --- /dev/null +++ b/integration-test/test.sh @@ -0,0 +1,21 @@ +#!/bin/bash +set -euo pipefail +IFS=$'\n\t' +set -x + +commit=1366a1f06d43e9d1cd53e3dd022df3b4ee47c8d3 + +if [[ -z "${TERITORI_DAPP_REPO:-}" ]]; then + rm -fr teritori-dapp + git clone https://github.com/TERITORI/teritori-dapp.git + cd teritori-dapp + git checkout $commit +else + cd $TERITORI_DAPP_REPO +fi + +yarn + +while ! curl -s http://localhost:26657/status | jq -e '.result.sync_info.latest_block_height|tonumber > 0'; do sleep 5; done + +npx tsx packages/scripts/network-setup/deploy teritori-localnet validator \ No newline at end of file