run_fvt_tests.yaml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  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. cluster_db_backend:
  67. - "mnesia"
  68. # FIXME: temporarily disabled: too flaky at the moment
  69. # - "rlog"
  70. steps:
  71. - uses: actions/download-artifact@v2
  72. with:
  73. name: source-${{ matrix.otp }}
  74. path: .
  75. - name: unzip source code
  76. run: unzip -q source-${{ matrix.otp }}.zip
  77. - name: make docker image
  78. working-directory: source
  79. env:
  80. OTP: ${{ matrix.otp }}
  81. run: |
  82. make ${{ needs.prepare.outputs.profile }}-docker
  83. echo "TARGET=emqx/${{ needs.prepare.outputs.profile }}" >> $GITHUB_ENV
  84. echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
  85. - name: run emqx
  86. timeout-minutes: 5
  87. working-directory: source
  88. run: |
  89. set -x
  90. export EMQX_TEST_DB_BACKEND="${{ matrix.cluster_db_backend }}"
  91. ./.ci/docker-compose-file/scripts/run-emqx.sh
  92. - name: make paho tests
  93. run: |
  94. if ! docker exec -i python /scripts/pytest.sh "${{ matrix.cluster_db_backend }}"; then
  95. echo "DUMP_CONTAINER_LOGS_BGN"
  96. echo "============== haproxy =============="
  97. docker logs haproxy
  98. echo "============== node1 =============="
  99. docker logs node1.emqx.io
  100. echo "============== node2 =============="
  101. docker logs node2.emqx.io
  102. echo "DUMP_CONTAINER_LOGS_END"
  103. exit 1
  104. fi
  105. helm_test:
  106. runs-on: ubuntu-20.04
  107. needs: prepare
  108. strategy:
  109. fail-fast: false
  110. matrix:
  111. otp:
  112. - 23.2.7.2-emqx-2
  113. - 24.1.1-emqx-1
  114. steps:
  115. - uses: actions/download-artifact@v2
  116. with:
  117. name: source-${{ matrix.otp }}
  118. path: .
  119. - name: unzip source code
  120. run: unzip -q source-${{ matrix.otp }}.zip
  121. - name: make docker image
  122. working-directory: source
  123. env:
  124. OTP: ${{ matrix.otp }}
  125. run: |
  126. make ${{ needs.prepare.outputs.profile }}-docker
  127. echo "TARGET=emqx/${{ needs.prepare.outputs.profile }}" >> $GITHUB_ENV
  128. echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
  129. - run: minikube start
  130. - name: run emqx on chart
  131. timeout-minutes: 5
  132. working-directory: source
  133. run: |
  134. minikube image load $TARGET:$EMQX_TAG
  135. sed -i -r "s/^appVersion: .*$/appVersion: \"$EMQX_TAG\"/g" deploy/charts/emqx/Chart.yaml
  136. helm install emqx \
  137. --set image.repository=$TARGET \
  138. --set image.pullPolicy=Never \
  139. --set emqxAclConfig="" \
  140. --set image.pullPolicy=Never \
  141. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__RETRY_INTERVAL=2s \
  142. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__MAX_TOPIC_ALIAS=10 \
  143. deploy/charts/emqx \
  144. --debug
  145. while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
  146. != "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
  147. echo "==============================";
  148. kubectl get pods;
  149. echo "==============================";
  150. echo "waiting emqx started";
  151. sleep 10;
  152. done
  153. - name: get emqx-0 pods log
  154. if: failure()
  155. run: |
  156. kubectl describe pods emqx-0
  157. kubectl logs emqx-0
  158. - name: get emqx-1 pods log
  159. if: failure()
  160. run: |
  161. kubectl describe pods emqx-1
  162. kubectl logs emqx-1
  163. - name: get emqx-2 pods log
  164. if: failure()
  165. run: |
  166. kubectl describe pods emqx-2
  167. kubectl logs emqx-2
  168. - uses: actions/checkout@v2
  169. with:
  170. repository: emqx/paho.mqtt.testing
  171. ref: develop-4.0
  172. path: paho.mqtt.testing
  173. - name: install pytest
  174. run: |
  175. pip install pytest
  176. echo "$HOME/.local/bin" >> $GITHUB_PATH
  177. - name: run paho test
  178. run: |
  179. kubectl port-forward service/emqx 1883:1883 > /dev/null &
  180. pytest -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host "127.0.0.1"