From 184b337e8477d53cac4dcfb8ad2a9e876e1b9508 Mon Sep 17 00:00:00 2001 From: "Zaiming (Stone) Shi" Date: Tue, 28 Jun 2022 10:54:07 +0200 Subject: [PATCH] chore: add a script to run relup lux test locally --- .ci/fvt_tests/relup.lux | 16 +++++----- .github/workflows/run_relup_tests.yaml | 2 +- scripts/run-relup-lux.sh | 42 ++++++++++++++++++++++++++ scripts/start-two-nodes-in-docker.sh | 2 +- 4 files changed, 51 insertions(+), 11 deletions(-) create mode 100755 scripts/run-relup-lux.sh diff --git a/.ci/fvt_tests/relup.lux b/.ci/fvt_tests/relup.lux index 83937291a..de48a723a 100644 --- a/.ci/fvt_tests/relup.lux +++ b/.ci/fvt_tests/relup.lux @@ -1,5 +1,5 @@ +[config var=PROJ_ROOT] [config var=PROFILE] -[config var=PACKAGE_PATH] [config var=VSN] [config var=CUR_PKG] [config var=OLD_VSN] @@ -19,21 +19,19 @@ ?> [shell emqx1] - !cd $PACKAGE_PATH + !cd $PROJ_ROOT !mkdir -p emqx1 !tar -C emqx1 -zxf "$OLD_PKG" ?SH-PROMPT !cd emqx1 !export EMQX_NODE_NAME='emqx1@127.0.0.1' -# debug boot - !sed 's/-boot_var RELEASE_LIB/-init_debug -boot_var RELEASE_LIB/g' -i ./bin/emqx !./bin/emqx start ?EMQX .* is started successfully! ?SH-PROMPT [shell emqx2] - !cd $PACKAGE_PATH + !cd $PROJ_ROOT !mkdir -p emqx2 !tar -C emqx2 -zxf "$OLD_PKG" ?SH-PROMPT @@ -182,7 +180,7 @@ ?SH-PROMPT [shell emqx2] - !cat log/emqx.log.1 |grep -v 691c29ba |tail -n 100 + !cat log/emqx.log.1 | tail -n 100 -error ??SH-PROMPT: @@ -190,11 +188,11 @@ ?ok ?SH-PROMPT: - !rm -rf $PACKAGE_PATH/emqx2 + !rm -rf emqx2/ ?SH-PROMPT: [shell emqx1] - !cat log/emqx.log.1 |grep -v 691c29ba |tail -n 100 + !cat log/emqx.log.1 | tail -n 100 -error ??SH-PROMPT: @@ -202,7 +200,7 @@ ?ok ?SH-PROMPT: - !rm -rf $PACKAGE_PATH/emqx + !rm -rf emqx1/ ?SH-PROMPT: [shell http_server] diff --git a/.github/workflows/run_relup_tests.yaml b/.github/workflows/run_relup_tests.yaml index 061ca3d20..d5c140763 100644 --- a/.github/workflows/run_relup_tests.yaml +++ b/.github/workflows/run_relup_tests.yaml @@ -119,8 +119,8 @@ jobs: lux \ --progress verbose \ --case_timeout infinity \ + --var PROJ_ROOT="$(pwd)" \ --var PROFILE="$profile" \ - --var PACKAGE_PATH=$(pwd)/packages \ --var VSN="$cur_vsn" \ --var OLD_VSN="$OLD_VSN" \ --var CUR_PKG="$cur_pkg" \ diff --git a/scripts/run-relup-lux.sh b/scripts/run-relup-lux.sh new file mode 100755 index 000000000..5b859c2c0 --- /dev/null +++ b/scripts/run-relup-lux.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +## This script needs the 'lux' command in PATH +## it runs the .ci/fvt_tests/relup.lux script + +set -euo pipefail + +old_vsn="${1}" + +# ensure dir +cd -P -- "$(dirname -- "$0")/.." + +set -x + +case "$old_vsn" in + e*) + cur_vsn="$(./pkg-vsn.sh emqx-enterprise)" + profile='emqx-enterprise' + ;; + v*) + cur_vsn="$(./pkg-vsn.sh emqx)" + profile='emqx' + ;; + *) + echo "unknown old version $old_vsn" + exit 1 + ;; +esac + +old_pkg="$(pwd)/_upgrade_base/${profile}-${old_vsn#[e|v]}-otp24.2.1-1-ubuntu20.04-amd64.tar.gz" +cur_pkg="$(pwd)/_packages/${profile}/${profile}-${cur_vsn}-otp24.2.1-1-ubuntu20.04-amd64.tar.gz" + +lux \ + --progress verbose \ + --case_timeout infinity \ + --var PROJ_ROOT="$(pwd)" \ + --var PROFILE="$profile" \ + --var VSN="$cur_vsn" \ + --var OLD_VSN="$old_vsn" \ + --var CUR_PKG="$cur_pkg" \ + --var OLD_PKG="$old_pkg" \ + .ci/fvt_tests/relup.lux diff --git a/scripts/start-two-nodes-in-docker.sh b/scripts/start-two-nodes-in-docker.sh index 64a6647ce..27ec4a1b2 100755 --- a/scripts/start-two-nodes-in-docker.sh +++ b/scripts/start-two-nodes-in-docker.sh @@ -40,7 +40,7 @@ docker run -d -t --restart=always --name "$NODE2" \ -p 18084:18083 \ "$IMAGE" -wait (){ +wait () { container="$1" while ! docker exec "$container" emqx_ctl status >/dev/null 2>&1; do echo -n '.'