run-relup-lux.sh 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. #!/usr/bin/env bash
  2. ## This script needs the 'lux' command in PATH
  3. ## it runs the scripts/relup-test/relup.lux script
  4. set -euo pipefail
  5. old_vsn="${1:-}"
  6. if [ -z "$old_vsn" ]; then
  7. echo "arg1 should be the upgrade base version"
  8. exit 1
  9. fi
  10. rebuild="${2:-no_rebuild}"
  11. # ensure dir
  12. cd -P -- "$(dirname -- "$0")/../.."
  13. set -x
  14. if [ ! -d '.git' ] && [ -z "${CUR_VSN:-}" ]; then
  15. echo "Unable to resolve current version, because it's not a git repo, and CUR_VSN is not set"
  16. exit 1
  17. fi
  18. case "$old_vsn" in
  19. e*)
  20. cur_vsn="${CUR_VSN:-$(./pkg-vsn.sh emqx-enterprise)}"
  21. profile='emqx-enterprise'
  22. ;;
  23. v*)
  24. cur_vsn="${CUR_VSN:-$(./pkg-vsn.sh emqx)}"
  25. profile='emqx'
  26. ;;
  27. *)
  28. echo "unknown old version $old_vsn"
  29. exit 1
  30. ;;
  31. esac
  32. if [ "$rebuild" = "--build" ]; then
  33. make "${profile}-tgz"
  34. fi
  35. # From now on, no need for the v|e prefix
  36. OLD_VSN="${old_vsn#[e|v]}"
  37. OLD_PKG="$(pwd)/_upgrade_base/${profile}-${OLD_VSN}-ubuntu20.04-amd64.tar.gz"
  38. CUR_PKG="$(pwd)/_packages/${profile}/${profile}-${cur_vsn}-ubuntu20.04-amd64.tar.gz"
  39. if [ ! -f "$OLD_PKG" ]; then
  40. echo "$OLD_PKG not found"
  41. exit 1
  42. fi
  43. if [ ! -f "$CUR_PKG" ]; then
  44. echo "$CUR_PKG not found"
  45. exit 1
  46. fi
  47. # start two nodes and their friends (webhook server and a bench) in docker
  48. ./scripts/relup-test/start-relup-test-cluster.sh 'ubuntu:20.04' "$OLD_PKG"
  49. # run relup tests
  50. lux \
  51. --progress verbose \
  52. --case_timeout infinity \
  53. --var PROJ_ROOT="$(pwd)" \
  54. --var VSN="$cur_vsn" \
  55. --var CUR_PKG="$CUR_PKG" \
  56. --var OLD_VSN="$OLD_VSN" \
  57. --var NODE1="node1.emqx.io" \
  58. --var NODE2="node2.emqx.io" \
  59. --var BENCH="bench.emqx.io" \
  60. ./scripts/relup-test/relup.lux