Skip to content

Commit

Permalink
Merge pull request #561 from zigbee-alliance/improve-upgrade-tests
Browse files Browse the repository at this point in the history
Refactor update tests for sequential version upgrades starting from initial version
  • Loading branch information
akarabashov authored Apr 17, 2024
2 parents 9ad0b95 + 35e20d1 commit 4eece29
Show file tree
Hide file tree
Showing 9 changed files with 2,585 additions and 3,295 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ func New(
)

app.UpgradeKeeper.SetUpgradeHandler(
"v1.3",
"v1.4",
func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.mm.RunMigrations(ctx, cfg, fromVM)
},
Expand Down
38 changes: 23 additions & 15 deletions integration_tests/run-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,17 @@ patch_consensus_config() {
init_pool() {
local _patch_config="${1:-yes}";
local _localnet_init_target=${2:-localnet_init}
local _binary_version=${3:-""}

log "Setting up pool"

log "-> Generating network configuration" >${DETAILED_OUTPUT_TARGET}
make ${_localnet_init_target} &>${DETAILED_OUTPUT_TARGET}
if [ -n "$_binary_version" ]; then
log "-> Generating network configuration with binary version=$_binary_version" >${DETAILED_OUTPUT_TARGET}
make ${_localnet_init_target} MAINNET_STABLE_VERSION=$_binary_version &>${DETAILED_OUTPUT_TARGET}
else
log "-> Generating network configuration" >${DETAILED_OUTPUT_TARGET}
make ${_localnet_init_target} &>${DETAILED_OUTPUT_TARGET}
fi

if [ "$_patch_config" = "yes" ];
then
Expand Down Expand Up @@ -187,21 +193,23 @@ fi

# Upgrade procedure tests
if [[ $TESTS_TO_RUN =~ "all" || $TESTS_TO_RUN =~ "upgrade" ]]; then
UPGRADE_SHELL_TESTS=$(find integration_tests/upgrade -type f -name '*.sh' -not -name "add-new-node-after-upgrade.sh" | sort)
UPGRADE_SHELL_TEST="./integration_tests/upgrade/test-upgrade.sh"

for UPGRADE_SHELL_TEST in ${UPGRADE_SHELL_TESTS}; do
log "*****************************************************************************************"
log "Running $UPGRADE_SHELL_TEST"
log "*****************************************************************************************"
init_pool yes localnet_init_latest_stable_release "v0.12.0"

if bash "$UPGRADE_SHELL_TEST" &>${DETAILED_OUTPUT_TARGET}; then
log "$UPGRADE_SHELL_TEST finished successfully"
else
log "$UPGRADE_SHELL_TEST failed"
exit 1
fi
log "*****************************************************************************************"
log "Running $UPGRADE_SHELL_TEST"
log "*****************************************************************************************"

cleanup_pool
done
if bash "$UPGRADE_SHELL_TEST" &>${DETAILED_OUTPUT_TARGET}; then
rm dcld_mainnet_stable
log "$UPGRADE_SHELL_TEST finished successfully"
source integration_tests/upgrade/add-new-node-after-upgrade.sh
check_adding_new_node
else
log "$UPGRADE_SHELL_TEST failed"
exit 1
fi

cleanup_pool
fi
Loading

0 comments on commit 4eece29

Please sign in to comment.