run_fvt_tests.yaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. name: Functional Verification Tests
  2. concurrency:
  3. group: fvt-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. push:
  7. tags:
  8. - v*
  9. - e*
  10. pull_request:
  11. jobs:
  12. prepare:
  13. strategy:
  14. matrix:
  15. otp:
  16. - "23.2.7.2-emqx-2"
  17. - "24.1.1-emqx-1"
  18. runs-on: ubuntu-20.04
  19. container: "ghcr.io/emqx/emqx-builder/5.0:${{ matrix.otp }}-ubuntu20.04"
  20. outputs:
  21. profile: ${{ steps.profile.outputs.profile }}
  22. steps:
  23. - name: get otp version
  24. id: get_otp_version
  25. run: |
  26. otp="$(erl -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), "releases", erlang:system_info(otp_release), "OTP_VERSION"])), io:fwrite(Version), halt().' -noshell)"
  27. echo "::set-output name=otp::$otp"
  28. - uses: actions/checkout@v2
  29. with:
  30. path: source
  31. fetch-depth: 0
  32. - name: set profile
  33. id: profile
  34. shell: bash
  35. working-directory: source
  36. run: |
  37. vsn="$(./pkg-vsn.sh)"
  38. if make emqx-ee --dry-run > /dev/null 2>&1; then
  39. echo "https://ci%40emqx.io:${{ secrets.CI_GIT_TOKEN }}@github.com" > $HOME/.git-credentials
  40. git config --global credential.helper store
  41. echo "::set-output name=profile::emqx-ee"
  42. else
  43. echo "::set-output name=profile::emqx"
  44. fi
  45. - name: get deps
  46. working-directory: source
  47. run: |
  48. make ensure-rebar3
  49. ./rebar3 as default get-deps
  50. rm -rf rebar.lock
  51. - name: gen zip file
  52. run: zip -ryq source-${{ steps.get_otp_version.outputs.otp }}.zip source/* source/.[^.]*
  53. - uses: actions/upload-artifact@v2
  54. with:
  55. name: source-${{ steps.get_otp_version.outputs.otp }}
  56. path: source-${{ steps.get_otp_version.outputs.otp }}.zip
  57. docker_test:
  58. runs-on: ubuntu-20.04
  59. needs: prepare
  60. strategy:
  61. fail-fast: false
  62. matrix:
  63. otp:
  64. - 23.2.7.2-emqx-2
  65. - 24.1.1-emqx-1
  66. steps:
  67. - uses: actions/download-artifact@v2
  68. with:
  69. name: source-${{ matrix.otp }}
  70. path: .
  71. - name: unzip source code
  72. run: unzip -q source-${{ matrix.otp }}.zip
  73. - name: make docker image
  74. working-directory: source
  75. env:
  76. OTP: ${{ matrix.otp }}
  77. run: |
  78. make ${{ needs.prepare.outputs.profile }}-docker
  79. echo "TARGET=emqx/${{ needs.prepare.outputs.profile }}" >> $GITHUB_ENV
  80. echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
  81. - name: run emqx
  82. timeout-minutes: 5
  83. working-directory: source
  84. run: |
  85. set -e -u -x
  86. echo "HOCON_ENV_OVERRIDE_PREFIX=EMQX_" >> .ci/docker-compose-file/conf.cluster.env
  87. echo "EMQX_ZONES__DEFAULT__MQTT__RETRY_INTERVAL=2s" >> .ci/docker-compose-file/conf.cluster.env
  88. echo "EMQX_ZONES__DEFAULT__MQTT__MAX_TOPIC_ALIAS=10" >> .ci/docker-compose-file/conf.cluster.env
  89. docker-compose \
  90. -f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \
  91. -f .ci/docker-compose-file/docker-compose-python.yaml \
  92. up -d
  93. while ! docker exec -i node1.emqx.io bash -c "emqx eval \"['emqx@node1.emqx.io','emqx@node2.emqx.io'] = maps:get(running_nodes, ekka_cluster:info()).\"" > /dev/null 2>&1; do
  94. echo "['$(date -u +"%Y-%m-%dT%H:%M:%SZ")']:waiting emqx";
  95. sleep 5;
  96. done
  97. - name: make paho tests
  98. run: |
  99. if ! docker exec -i python /scripts/pytest.sh; then
  100. echo "DUMP_CONTAINER_LOGS_BGN"
  101. docker logs haproxy
  102. docker logs node1.emqx.io
  103. docker logs node2.emqx.io
  104. echo "DUMP_CONTAINER_LOGS_END"
  105. exit 1
  106. fi
  107. helm_test:
  108. runs-on: ubuntu-20.04
  109. needs: prepare
  110. strategy:
  111. fail-fast: false
  112. matrix:
  113. otp:
  114. - 23.2.7.2-emqx-2
  115. - 24.1.1-emqx-1
  116. steps:
  117. - uses: actions/download-artifact@v2
  118. with:
  119. name: source-${{ matrix.otp }}
  120. path: .
  121. - name: unzip source code
  122. run: unzip -q source-${{ matrix.otp }}.zip
  123. - name: make docker image
  124. working-directory: source
  125. env:
  126. OTP: ${{ matrix.otp }}
  127. run: |
  128. make ${{ needs.prepare.outputs.profile }}-docker
  129. echo "TARGET=emqx/${{ needs.prepare.outputs.profile }}" >> $GITHUB_ENV
  130. echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
  131. - run: minikube start
  132. - name: run emqx on chart
  133. timeout-minutes: 5
  134. working-directory: source
  135. run: |
  136. minikube image load $TARGET:$EMQX_TAG
  137. sed -i -r "s/^appVersion: .*$/appVersion: \"$EMQX_TAG\"/g" deploy/charts/emqx/Chart.yaml
  138. helm install emqx \
  139. --set image.repository=$TARGET \
  140. --set image.pullPolicy=Never \
  141. --set emqxAclConfig="" \
  142. --set image.pullPolicy=Never \
  143. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__RETRY_INTERVAL=2s \
  144. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__MAX_TOPIC_ALIAS=10 \
  145. deploy/charts/emqx \
  146. --debug
  147. while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
  148. != "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
  149. echo "==============================";
  150. kubectl get pods;
  151. echo "==============================";
  152. echo "waiting emqx started";
  153. sleep 10;
  154. done
  155. - name: get emqx-0 pods log
  156. if: failure()
  157. run: |
  158. kubectl describe pods emqx-0
  159. kubectl logs emqx-0
  160. - name: get emqx-1 pods log
  161. if: failure()
  162. run: |
  163. kubectl describe pods emqx-1
  164. kubectl logs emqx-1
  165. - name: get emqx-2 pods log
  166. if: failure()
  167. run: |
  168. kubectl describe pods emqx-2
  169. kubectl logs emqx-2
  170. - uses: actions/checkout@v2
  171. with:
  172. repository: emqx/paho.mqtt.testing
  173. ref: develop-4.0
  174. path: paho.mqtt.testing
  175. - name: install pytest
  176. run: |
  177. pip install pytest
  178. echo "$HOME/.local/bin" >> $GITHUB_PATH
  179. - name: run paho test
  180. run: |
  181. kubectl port-forward service/emqx 1883:1883 > /dev/null &
  182. pytest -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host "127.0.0.1"