relup.lux 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. [config var=PROJ_ROOT]
  2. [config var=VSN]
  3. [config var=CUR_PKG]
  4. [config var=OLD_VSN]
  5. [config var=NODE1]
  6. [config var=NODE2]
  7. [config var=BENCH]
  8. [config shell_cmd=/bin/bash]
  9. [config timeout=600000]
  10. [shell emqx1]
  11. !docker exec -it $NODE1 emqx_ctl cluster status
  12. ???running_nodes => ['emqx@node1.emqx.io','emqx@node2.emqx.io']
  13. ?SH-PROMPT
  14. ## create a webhook data bridge with id "my_webhook"
  15. !curl --user admin:public --silent --show-error 'http://localhost:18083/api/v5/bridges' -X 'POST' -H 'Content-Type: application/json' --data-binary '{"name":"my_webhook","body":"","method":"post","url":"http://webhook.emqx.io:7077/counter","headers":{"content-type":"application/json"},"pool_size":4,"enable_pipelining":100,"connect_timeout":"5s","type":"webhook","ssl":{"enable":false,"verify":"verify_none"}}' | jq '.status'
  16. ?connected
  17. ?SH-PROMPT
  18. ## create a rule that uses the webhook as action, the rule id = "rule_edsy"
  19. !curl --user admin:public --silent --show-error 'http://localhost:18083/api/v5/rules' -X 'POST' -H 'Content-Type: application/json' --data-binary '{"id":"rule_edsy","sql":"SELECT\n *\nFROM\n \"t/#\"","actions":["webhook:my_webhook"]}' | jq '.id'
  20. ?rule_edsy
  21. ?SH-PROMPT
  22. [shell emqx2]
  23. ## verify the bridges and rules are sync to the other node
  24. !curl --user admin:public --silent --show-error 'http://localhost:18084/api/v5/bridges/webhook:my_webhook' -X 'GET' -H 'Content-Type: application/json' | jq '.name'
  25. ?my_webhook
  26. ?SH-PROMPT
  27. !curl --user admin:public --silent --show-error 'http://localhost:18084/api/v5/rules/rule_edsy' -X 'GET' -H 'Content-Type: application/json' | jq '.id'
  28. ?rule_edsy
  29. ?SH-PROMPT
  30. [shell bench]
  31. !docker exec -it $BENCH emqtt_bench pub --host 'node1.emqx.io' --port 1883 -c 10 -I 1000 -t t/%i -s 64 -L 300
  32. [shell emqx1]
  33. !docker cp $CUR_PKG $NODE1:/emqx/releases/
  34. ## 1. upgrade to the new version
  35. !docker exec -it $NODE1 emqx install $VSN
  36. ?Made release permanent: "$VSN"
  37. ?SH-PROMPT
  38. !docker exec -it $NODE1 emqx versions | grep permanent
  39. ?(.*)$VSN
  40. ?SH-PROMPT
  41. ## 2. downgrade to the old version
  42. !docker exec -it $NODE1 emqx install $OLD_VSN
  43. ?Made release permanent:.*
  44. ?SH-PROMPT
  45. !docker exec -it $NODE1 emqx versions | grep permanent | grep -qs "$OLD_VSN"
  46. ?SH-PROMPT:
  47. !echo ==$$?==
  48. ?^==0==
  49. ?SH-PROMPT:
  50. ## 3. again, upgrade to the new version
  51. !docker exec -it $NODE1 emqx install $VSN
  52. ?Made release permanent: "$VSN"
  53. ?SH-PROMPT
  54. !docker exec -it $NODE1 emqx versions | grep permanent
  55. ?(.*)$VSN
  56. ?SH-PROMPT
  57. !docker exec -it $NODE1 emqx_ctl cluster status
  58. ???running_nodes => ['emqx@node1.emqx.io','emqx@node2.emqx.io']
  59. ?SH-PROMPT
  60. [shell emqx2]
  61. !docker cp $CUR_PKG $NODE2:/emqx/releases/
  62. ## 1. upgrade to the new version
  63. !docker exec -it $NODE2 emqx install $VSN
  64. ?Made release permanent: "$VSN"
  65. ?SH-PROMPT
  66. !docker exec -it $NODE2 emqx versions | grep permanent
  67. ?(.*)$VSN
  68. ?SH-PROMPT
  69. ## 2. downgrade to the old version
  70. !docker exec -it $NODE2 emqx install $OLD_VSN
  71. ?Made release permanent:.*
  72. ?SH-PROMPT
  73. !docker exec -it $NODE2 emqx versions | grep permanent | grep -qs "$OLD_VSN"
  74. ?SH-PROMPT:
  75. !echo ==$$?==
  76. ?^==0==
  77. ?SH-PROMPT:
  78. ## 3. again, upgrade to the new version
  79. !docker exec -it $NODE2 emqx install $VSN
  80. ?Made release permanent: "$VSN"
  81. ?SH-PROMPT
  82. !docker exec -it $NODE2 emqx versions | grep permanent
  83. ?(.*)$VSN
  84. ?SH-PROMPT
  85. !docker exec -it $NODE1 emqx_ctl cluster status
  86. ???running_nodes => ['emqx@node1.emqx.io','emqx@node2.emqx.io']
  87. ?SH-PROMPT
  88. ## We don't guarantee not to lose a single message!
  89. ## So even if we received 290~300 messages, we consider it as success
  90. [shell bench]
  91. ???publish complete
  92. ??SH-PROMPT:
  93. !sleep 5
  94. ?SH-PROMPT
  95. !$PROJ_ROOT/scripts/relup-test/check-results.sh
  96. !echo ==$$?==
  97. ???ALL_IS_WELL
  98. ?SH-PROMPT:
  99. !echo ==$$?==
  100. ?^==0==
  101. ?SH-PROMPT:
  102. [cleanup]
  103. !echo ==$$?==
  104. ?==0==