run_fvt_tests.yaml 7.5 KB

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