From a4abd9d3e076ca0dbc6fe9e2a24223ef074ce402 Mon Sep 17 00:00:00 2001 From: n0izn0iz Date: Sun, 21 Jan 2024 23:41:05 +0100 Subject: [PATCH] feat: more integration tests (#83) * feat: basic integration test Signed-off-by: Norman Meier * feat: upgrade integration-test Signed-off-by: Norman Meier * fix: commit Signed-off-by: Norman Meier * chore: update test Signed-off-by: Norman Meier * chore: update test Signed-off-by: Norman Meier * chore: update test Signed-off-by: Norman Meier * chore: update test Signed-off-by: Norman Meier * fix: node version Signed-off-by: Norman Meier * chore: update test Signed-off-by: Norman Meier * chore: update test Signed-off-by: Norman Meier * chore: optimize integration workflow Signed-off-by: Norman Meier * chore: update testsg Signed-off-by: Norman Meier --------- Signed-off-by: Norman Meier --- .github/workflows/integration.yml | 20 ++++++++++++++++---- .gitignore | 3 ++- Makefile | 4 ++-- integration-test/run.sh | 17 +++++++++++++++-- integration-test/test.sh | 21 --------------------- 5 files changed, 35 insertions(+), 30 deletions(-) delete mode 100755 integration-test/test.sh diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index 7dae33f..e42779e 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -8,9 +8,17 @@ on: jobs: test: - runs-on: ubuntu-latest + # teritorid hangs on ubuntu runner + runs-on: macos-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + - name: Checkout teritori-dapp repo + uses: actions/checkout@v4 + with: + repository: TERITORI/teritori-dapp + path: teritori-dapp + ref: 66134e9580135a07aba64e00b68af9f30f8fdb93 - uses: actions/setup-go@v3 with: @@ -19,6 +27,10 @@ jobs: - uses: actions/setup-node@v3 with: node-version: 18 + cache: "yarn" + cache-dependency-path: "teritori-dapp/yarn.lock" - - name: Run integration test - run: make integration-test + - name: Run integration tests + run: make integration-tests + env: + TERITORI_DAPP_REPO: teritori-dapp diff --git a/.gitignore b/.gitignore index 168bfb1..2ba299a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ data *.txt .idea -/teritori-dapp/ \ No newline at end of file +/teritori-dapp/ +/build/ diff --git a/Makefile b/Makefile index e97c05e..7057f2e 100644 --- a/Makefile +++ b/Makefile @@ -214,6 +214,6 @@ docker.publish: docker build . --platform linux/amd64 -t $(IMAGE_TAG) docker push $(IMAGE_TAG) -.PHONY: integration-test -integration-test: +.PHONY: integration-tests +integration-tests: ./integration-test/run.sh \ No newline at end of file diff --git a/integration-test/run.sh b/integration-test/run.sh index f37ca5e..bddc419 100755 --- a/integration-test/run.sh +++ b/integration-test/run.sh @@ -3,6 +3,19 @@ set -euo pipefail IFS=$'\n\t' set -x -make install +commit=66134e9580135a07aba64e00b68af9f30f8fdb93 -parallel --lb -j2 --halt now,done=1 ::: './start.sh >> node_logs.txt 2>&1' './integration-test/test.sh' \ No newline at end of file +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 + +npx tsx packages/scripts/integration-testing/simpleTest .. +npx tsx packages/scripts/integration-testing/upgradeTest142toDir .. +npx tsx packages/scripts/integration-testing/upgradeTest120toDir .. \ No newline at end of file diff --git a/integration-test/test.sh b/integration-test/test.sh deleted file mode 100755 index 2ad285b..0000000 --- a/integration-test/test.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/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