run_fvt_tests.yaml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. pull_request:
  10. jobs:
  11. prepare:
  12. runs-on: ubuntu-20.04
  13. # prepare source with any OTP version, no need for a matrix
  14. container: ghcr.io/emqx/emqx-builder/5.0-3:24.1.5-3-alpine3.14
  15. steps:
  16. - uses: actions/checkout@v2
  17. with:
  18. path: source
  19. fetch-depth: 0
  20. - name: get deps
  21. run: |
  22. make -C source deps-all
  23. zip -ryq source.zip source/* source/.[^.]*
  24. - uses: actions/upload-artifact@v2
  25. with:
  26. name: source
  27. path: source.zip
  28. docker_test:
  29. runs-on: ubuntu-20.04
  30. needs: prepare
  31. strategy:
  32. fail-fast: false
  33. matrix:
  34. profile:
  35. - emqx
  36. - emqx-edge
  37. - emqx-enterprise
  38. cluster_db_backend:
  39. - mnesia
  40. - rlog
  41. os:
  42. - alpine3.14
  43. otp:
  44. - 24.1.5-3
  45. arch:
  46. - amd64
  47. exclude:
  48. - profile: emqx-edge
  49. cluster_db_backend: rlog
  50. steps:
  51. - uses: actions/download-artifact@v2
  52. with:
  53. name: source
  54. path: .
  55. - name: unzip source code
  56. run: unzip -q source.zip
  57. - name: Get deps git refs for cache
  58. id: deps-refs
  59. run: |
  60. cd source
  61. make ensure-rebar3
  62. sudo cp rebar3 /usr/local/bin/rebar3
  63. scripts/get-dep-refs.sh
  64. - name: load rocksdb cache
  65. uses: actions/cache@v2
  66. with:
  67. path: source/_build/default/lib/rocksdb/
  68. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  69. - name: load quicer cache
  70. uses: actions/cache@v2
  71. with:
  72. path: source/_build/default/lib/quicer/
  73. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  74. - name: make docker image
  75. working-directory: source
  76. env:
  77. EMQX_BUILDER: ghcr.io/emqx/emqx-builder/5.0-3:${{ matrix.otp }}-${{ matrix.os }}
  78. run: |
  79. make ${{ matrix.profile }}-docker
  80. - name: run emqx
  81. timeout-minutes: 5
  82. working-directory: source
  83. run: |
  84. set -x
  85. IMAGE=emqx/${{ matrix.profile }}:$(./pkg-vsn.sh)
  86. ./.ci/docker-compose-file/scripts/run-emqx.sh $IMAGE ${{ matrix.cluster_db_backend }}
  87. - name: make paho tests
  88. run: |
  89. if ! docker exec -i python /scripts/pytest.sh "${{ matrix.cluster_db_backend }}"; then
  90. echo "DUMP_CONTAINER_LOGS_BGN"
  91. echo "============== haproxy =============="
  92. docker logs haproxy
  93. echo "============== node1 =============="
  94. docker logs node1.emqx.io
  95. echo "============== node2 =============="
  96. docker logs node2.emqx.io
  97. echo "DUMP_CONTAINER_LOGS_END"
  98. exit 1
  99. fi
  100. helm_test:
  101. runs-on: ubuntu-20.04
  102. needs: prepare
  103. strategy:
  104. fail-fast: false
  105. matrix:
  106. profile:
  107. - emqx
  108. os:
  109. - alpine3.14
  110. otp:
  111. - 24.1.5-3
  112. arch:
  113. - amd64
  114. # - emqx-enterprise # TODO test enterprise
  115. steps:
  116. - uses: actions/download-artifact@v2
  117. with:
  118. name: source
  119. path: .
  120. - name: unzip source code
  121. run: unzip -q source.zip
  122. - name: Get deps git refs for cache
  123. id: deps-refs
  124. run: |
  125. cd source
  126. make ensure-rebar3
  127. sudo cp rebar3 /usr/local/bin/rebar3
  128. scripts/get-dep-refs.sh
  129. - name: load rocksdb cache
  130. uses: actions/cache@v2
  131. with:
  132. path: source/_build/default/lib/rocksdb/
  133. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_ROCKSDB_REF }}
  134. - name: load quicer cache
  135. uses: actions/cache@v2
  136. with:
  137. path: source/_build/default/lib/quicer/
  138. key: ${{ matrix.os }}-${{ matrix.otp }}-${{ matrix.arch }}-${{ steps.deps-refs.outputs.DEP_QUICER_REF }}
  139. - name: make docker image
  140. working-directory: source
  141. env:
  142. EMQX_BUILDER: ghcr.io/emqx/emqx-builder/5.0-3:${{ matrix.otp }}-${{ matrix.os }}
  143. run: |
  144. make ${{ matrix.profile }}-docker
  145. echo "TARGET=emqx/${{ matrix.profile }}" >> $GITHUB_ENV
  146. echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
  147. - run: minikube start
  148. - name: run emqx on chart
  149. timeout-minutes: 5
  150. working-directory: source
  151. run: |
  152. minikube image load $TARGET:$EMQX_TAG
  153. sed -i -r "s/^appVersion: .*$/appVersion: \"$EMQX_TAG\"/g" deploy/charts/emqx/Chart.yaml
  154. helm install emqx \
  155. --set image.repository=$TARGET \
  156. --set image.pullPolicy=Never \
  157. --set emqxAclConfig="" \
  158. --set image.pullPolicy=Never \
  159. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__RETRY_INTERVAL=2s \
  160. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__MAX_TOPIC_ALIAS=10 \
  161. deploy/charts/emqx \
  162. --debug
  163. while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
  164. != "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
  165. echo "==============================";
  166. kubectl get pods;
  167. echo "==============================";
  168. echo "waiting emqx started";
  169. sleep 10;
  170. done
  171. - name: get emqx-0 pods log
  172. if: failure()
  173. run: |
  174. kubectl describe pods emqx-0
  175. kubectl logs emqx-0
  176. - name: get emqx-1 pods log
  177. if: failure()
  178. run: |
  179. kubectl describe pods emqx-1
  180. kubectl logs emqx-1
  181. - name: get emqx-2 pods log
  182. if: failure()
  183. run: |
  184. kubectl describe pods emqx-2
  185. kubectl logs emqx-2
  186. - uses: actions/checkout@v2
  187. with:
  188. repository: emqx/paho.mqtt.testing
  189. ref: develop-4.0
  190. path: paho.mqtt.testing
  191. - name: install pytest
  192. run: |
  193. pip install pytest
  194. echo "$HOME/.local/bin" >> $GITHUB_PATH
  195. - name: run paho test
  196. run: |
  197. kubectl port-forward service/emqx 1883:1883 > /dev/null &
  198. pytest -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host "127.0.0.1"