run_fvt_tests.yaml 6.2 KB

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