diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 896563025e..b184370a3a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -66,7 +66,7 @@ jobs: test_required=$(./script/upgrades.sh test-required ${{ env.RELEASE_TAG }}) echo "TEST_REQUIRED=$test_required" >> $GITHUB_ENV - name: run test - if: env.TEST_REQUIRED == 'true' + if: env.TEST_REQUIRED != '' env: UPGRADE_BINARY_VERSION: ${{ env.RELEASE_TAG }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index febe345b61..b491cd1b96 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -195,7 +195,7 @@ jobs: - name: Ensure only directories exists in upgrades dir run: | dir=./upgrades/software - if [[ $(find "$dir" ! -path "$dir" -maxdepth 1 -type f | wc -c) -ne 0 ]]; then + if [[ $(find "$dir" ! -path "$dir" -maxdepth 1 -type f | wc -c) -ne 0 ]]; then echo "$dir must contain only directories" exit 1 fi @@ -204,7 +204,7 @@ jobs: dir=./upgrades/software while read upgrade; do ./script/semver.sh validate "$upgrade" - done <<< $(find "$dir" ! -path "$dir" -maxdepth 1 -type d -exec basename {} \;) + done <<< $(find "$dir" ! -path "$dir" -maxdepth 1 -type d -exec basename {} \;) network-upgrade: runs-on: upgrade-tester steps: @@ -225,7 +225,7 @@ jobs: echo "TEST_REQUIRED=$test_required" >> $GITHUB_ENV - name: run test id: test - if: env.TEST_REQUIRED == 'true' + if: env.TEST_REQUIRED != '' run: | cd tests/upgrade make test diff --git a/Makefile b/Makefile index 1ee9da4bfc..a78ddc6871 100644 --- a/Makefile +++ b/Makefile @@ -20,7 +20,6 @@ GIT_HEAD_COMMIT_LONG := $(shell git log -1 --format='%H') GIT_HEAD_COMMIT_SHORT := $(shell git rev-parse --short HEAD) GIT_HEAD_ABBREV := $(shell git rev-parse --abbrev-ref HEAD) -RELEASE_TAG ?= $(shell git describe --tags --abbrev=0) IS_PREREL := $(shell $(ROOT_DIR)/script/is_prerelease.sh "$(RELEASE_TAG)" && echo "true" || echo "false") IS_MAINNET := $(shell $(ROOT_DIR)/script/mainnet-from-tag.sh "$(RELEASE_TAG)" && echo "true" || echo "false") IS_STABLE ?= false diff --git a/make/init.mk b/make/init.mk index 4a012c02e7..6cbe0f7d4b 100644 --- a/make/init.mk +++ b/make/init.mk @@ -69,4 +69,6 @@ GOLANGCI_LINT := $(AKASH_DEVCACHE_BIN)/golangci-lint STATIK := $(AKASH_DEVCACHE_BIN)/statik COSMOVISOR := $(AKASH_DEVCACHE_BIN)/cosmovisor +RELEASE_TAG ?= $(shell git describe --tags --abbrev=0) + include $(AKASH_ROOT)/make/setup-cache.mk diff --git a/make/test-upgrade.mk b/make/test-upgrade.mk index 48a999012b..2c5ddd5c37 100644 --- a/make/test-upgrade.mk +++ b/make/test-upgrade.mk @@ -14,7 +14,8 @@ export AKASH_LOG_COLOR = true KEY_OPTS := --keyring-backend=$(AKASH_KEYRING_BACKEND) KEY_NAME ?= validator -UPGRADE_TO ?= v0.26.0 +UPGRADE_TO ?= $(shell $(ROOT_DIR)/script/upgrades.sh test-required $(RELEASE_TAG)) +# v0.28.0 UPGRADE_FROM := $(shell cat $(ROOT_DIR)/meta.json | jq -r --arg name $(UPGRADE_TO) '.upgrades[$$name].from_version' | tr -d '\n') GENESIS_BINARY_VERSION := $(shell cat $(ROOT_DIR)/meta.json | jq -r --arg name $(UPGRADE_TO) '.upgrades[$$name].from_binary' | tr -d '\n') UPGRADE_BINARY_VERSION ?= local @@ -42,7 +43,7 @@ test: $(COSMOVISOR) init .PHONY: test-reset test-reset: - $(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --uname=$(UPGRADE_TO) --config="$(PWD)/config.json" clean + $(ROOT_DIR)/script/upgrades.sh --workdir=$(AP_RUN_DIR) --config="$(PWD)/config.json" clean .PHONY: clean clean: diff --git a/script/upgrades.sh b/script/upgrades.sh index fa7671093f..f2f6fa1c6f 100755 --- a/script/upgrades.sh +++ b/script/upgrades.sh @@ -321,7 +321,7 @@ test-required) # current git reference is matching upgrade name. looks like release has been cut # so lets run the last test if [[ "$curr_ref" == "$upgrade_name" ]]; then - echo -e "true" + echo -e "$upgrade_name" exit 0 fi @@ -371,11 +371,7 @@ test-required) fi done - if [[ "$upgrade_name" == "" ]]; then - echo -n "false" - else - echo -n "true" - fi + echo -n "$upgrade_name" exit 0 ;; diff --git a/tests/upgrade/upgrade_test.go b/tests/upgrade/upgrade_test.go index 2f1e2994c7..f4e1b99f38 100644 --- a/tests/upgrade/upgrade_test.go +++ b/tests/upgrade/upgrade_test.go @@ -564,7 +564,7 @@ loop: l.t.Log("no post upgrade handlers found. submitting shutdown") _ = bus.Publish(postUpgradeTestDone{}) - break loop + break } l.t.Log("running post upgrade test handler") @@ -587,6 +587,7 @@ loop: }) } case postUpgradeTestDone: + l.t.Log("shutting down validator(s)") for _, val := range l.validators { _ = val.pubsub.Publish(eventShutdown{}) } @@ -1055,7 +1056,8 @@ loop: } for name, module := range migrations { - if module.status == testModuleStatusChecked { + switch module.status { + case testModuleStatusChecked: if !module.expected.compare(module.actual) { merr := fmt.Sprintf("migration for module (%s) finished with mismatched versions:\n"+ "\texpected:\n"+ @@ -1070,8 +1072,11 @@ loop: errs = append(errs, merr) } - } else { - merr := fmt.Sprintf("detected unexpected pmigration in module (%s)", name) + case testModuleStatusNotChecked: + merr := fmt.Sprintf("required migration for module module (%s) was not detected", name) + errs = append(errs, merr) + case testModuleStatusUnexpected: + merr := fmt.Sprintf("detected unexpected migration in module (%s)", name) errs = append(errs, merr) } }