run_fvt_tests.yaml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. name: Functional Verification Tests
  2. on:
  3. push:
  4. tags:
  5. - v*
  6. release:
  7. types:
  8. - published
  9. pull_request:
  10. jobs:
  11. docker_test:
  12. runs-on: ubuntu-20.04
  13. steps:
  14. - uses: actions/checkout@v1
  15. - name: make emqx image
  16. run: TARGET=emqx/emqx make docker
  17. - name: run emqx
  18. timeout-minutes: 5
  19. run: |
  20. set -e -u -x
  21. docker-compose -f .ci/fvt_tests/docker-compose.yaml up -d
  22. while [ "$(docker inspect -f '{{ .State.Health.Status}}' node1.emqx.io)" != "healthy" ] || [ "$(docker inspect -f '{{ .State.Health.Status}}' node2.emqx.io)" != "healthy" ]; do
  23. if [ $(docker ps -a -f name=fvt_tests_emqx -f status=exited -q | wc -l) -ne 0 ]; then
  24. echo "['$(date -u +"%Y-%m-%dT%H:%M:%SZ")']:emqx stop";
  25. exit;
  26. else
  27. echo "['$(date -u +"%Y-%m-%dT%H:%M:%SZ")']:waiting emqx";
  28. sleep 5;
  29. fi;
  30. done
  31. - name: make paho tests
  32. run: |
  33. docker exec -i paho_client sh -c "apk update && apk add git curl \
  34. && git clone -b develop-4.0 https://github.com/emqx/paho.mqtt.testing.git /paho.mqtt.testing \
  35. && pip install pytest \
  36. && pytest -v /paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host node1.emqx.io \
  37. && pytest -v /paho.mqtt.testing/interoperability/test_cluster --host1 node1.emqx.io --host2 node2.emqx.io \
  38. && pytest -v /paho.mqtt.testing/interoperability/test_client --host node1.emqx.io"
  39. helm_test:
  40. runs-on: ubuntu-20.04
  41. steps:
  42. - uses: actions/checkout@v1
  43. - name: make emqx image
  44. run: TARGET=emqx/emqx make docker
  45. - name: install k3s
  46. env:
  47. KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
  48. run: |
  49. sudo sh -c "echo \"127.0.0.1 $(hostname)\" >> /etc/hosts"
  50. curl -sfL https://get.k3s.io | sh -
  51. sudo chmod 644 /etc/rancher/k3s/k3s.yaml
  52. kubectl cluster-info
  53. - name: install helm
  54. env:
  55. KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
  56. run: |
  57. curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
  58. sudo chmod 700 get_helm.sh
  59. sudo ./get_helm.sh
  60. helm version
  61. - name: run emqx on chart
  62. env:
  63. KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
  64. timeout-minutes: 5
  65. run: |
  66. version=$(./pkg-vsn.sh)
  67. sudo docker save emqx/emqx:$version -o emqx.tar.gz
  68. sudo k3s ctr image import emqx.tar.gz
  69. sed -i -r "s/^appVersion: .*$/appVersion: \"${version}\"/g" deploy/charts/emqx/Chart.yaml
  70. sed -i -r 's/ pullPolicy: .*$/ pullPolicy: Never/g' deploy/charts/emqx/values.yaml
  71. sed -i '/emqx_telemetry/d' deploy/charts/emqx/values.yaml
  72. helm install emqx --set emqxAclConfig="" --set emqxConfig.EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s --set emqxConfig.EMQX_MQTT__MAX_TOPIC_ALIAS=10 deploy/charts/emqx --debug --dry-run
  73. helm install emqx --set emqxAclConfig="" --set emqxConfig.EMQX_ZONE__EXTERNAL__RETRY_INTERVAL=2s --set emqxConfig.EMQX_MQTT__MAX_TOPIC_ALIAS=10 deploy/charts/emqx
  74. while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
  75. != "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
  76. echo "==============================";
  77. kubectl get pods;
  78. echo "==============================";
  79. echo "waiting emqx started";
  80. sleep 10;
  81. done
  82. - name: get pods log
  83. if: failure()
  84. env:
  85. KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
  86. run: kubectl describe pods emqx-0
  87. - uses: actions/checkout@v2
  88. with:
  89. repository: emqx/paho.mqtt.testing
  90. ref: develop-4.0
  91. path: paho.mqtt.testing
  92. - name: install pytest
  93. run: |
  94. pip install pytest
  95. echo "$HOME/.local/bin" >> $GITHUB_PATH
  96. - name: run paho test
  97. env:
  98. KUBECONFIG: "/etc/rancher/k3s/k3s.yaml"
  99. run: |
  100. emqx_svc=$(kubectl get svc --namespace default emqx -o jsonpath="{.spec.clusterIP}")
  101. emqx1=$(kubectl get pods emqx-1 -o jsonpath='{.status.podIP}')
  102. emqx2=$(kubectl get pods emqx-2 -o jsonpath='{.status.podIP}')
  103. pytest -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host $emqx_svc
  104. pytest -v paho.mqtt.testing/interoperability/test_cluster --host1 $emqx1 --host2 $emqx2
  105. relup_test:
  106. runs-on: ubuntu-20.04
  107. container: emqx/build-env:erl23.2.2-ubuntu20.04
  108. defaults:
  109. run:
  110. shell: bash
  111. steps:
  112. - uses: actions/setup-python@v2
  113. with:
  114. python-version: '3.8'
  115. architecture: 'x64'
  116. - uses: actions/checkout@v2
  117. with:
  118. repository: emqx/paho.mqtt.testing
  119. ref: develop-4.0
  120. path: paho.mqtt.testing
  121. - uses: actions/checkout@v2
  122. with:
  123. repository: terry-xiaoyu/one_more_emqx
  124. ref: master
  125. path: one_more_emqx
  126. - uses: actions/checkout@v2
  127. with:
  128. repository: emqx/emqtt-bench
  129. ref: master
  130. path: emqtt-bench
  131. - uses: actions/checkout@v2
  132. with:
  133. repository: hawk/lux
  134. ref: lux-2.4
  135. path: lux
  136. - uses: actions/checkout@v2
  137. with:
  138. repository: ${{ github.repository }}
  139. path: emqx
  140. fetch-depth: 0
  141. - name: get version
  142. run: |
  143. set -e -x -u
  144. cd emqx
  145. vsn="$(erl -eval '{ok, [{application,emqx, L} | _]} = file:consult("src/emqx.app.src"), {vsn, VSN} = lists:keyfind(vsn,1,L), io:fwrite(VSN), halt().' -noshell)"
  146. echo "VSN=$vsn" >> $GITHUB_ENV
  147. pre_tag="$(echo $vsn | grep -oE '^[0-9]+.[0-9]')"
  148. old_vsns="$(git tag -l "$pre_tag.[0-9]" | tr "\n" " " | sed "s/$vsn//")"
  149. echo "OLD_VSNS=$old_vsns" >> $GITHUB_ENV
  150. - name: download emqx
  151. run: |
  152. set -e -x -u
  153. cd emqx
  154. old_vsns=($(echo $OLD_VSNS | tr ' ' ' '))
  155. for old_vsn in ${old_vsns[@]}; do
  156. wget https://s3-us-west-2.amazonaws.com/packages.emqx/emqx-ce/v$old_vsn/emqx-ubuntu20.04-${old_vsn}-x86_64.zip
  157. done
  158. - name: build emqx
  159. run: make -C emqx emqx-zip
  160. - name: build emqtt-bench
  161. run: make -C emqtt-bench
  162. - name: build lux
  163. run: |
  164. set -e -u -x
  165. cd lux
  166. autoconf
  167. ./configure
  168. make
  169. make install
  170. - name: run relup test
  171. run: |
  172. set -e -x -u
  173. if [ -n "$OLD_VSNS" ]; then
  174. mkdir -p packages
  175. cp emqx/_packages/emqx/*.zip packages
  176. cp emqx/*.zip packages
  177. lux -v \
  178. --timeout 600000 \
  179. --var PACKAGE_PATH=$(pwd)/packages \
  180. --var BENCH_PATH=$(pwd)/emqtt-bench \
  181. --var ONE_MORE_EMQX_PATH=$(pwd)/one_more_emqx \
  182. --var VSN="$VSN" \
  183. --var OLD_VSNS="$OLD_VSNS" \
  184. emqx/.ci/fvt_tests/relup.lux
  185. fi
  186. - uses: actions/upload-artifact@v1
  187. if: failure()
  188. with:
  189. name: lux_logs
  190. path: lux_logs