run_fvt_tests.yaml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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. exclude:
  42. - profile: emqx-edge
  43. cluster_db_backend: rlog
  44. steps:
  45. - uses: actions/download-artifact@v2
  46. with:
  47. name: source
  48. path: .
  49. - name: unzip source code
  50. run: unzip -q source.zip
  51. - name: make docker image
  52. working-directory: source
  53. env:
  54. EMQX_BUILDER: ghcr.io/emqx/emqx-builder/5.0-3:24.1.5-3-alpine3.14
  55. run: |
  56. make ${{ matrix.profile }}-docker
  57. - name: run emqx
  58. timeout-minutes: 5
  59. working-directory: source
  60. run: |
  61. set -x
  62. IMAGE=emqx/${{ matrix.profile }}:$(./pkg-vsn.sh)
  63. ./.ci/docker-compose-file/scripts/run-emqx.sh $IMAGE ${{ matrix.cluster_db_backend }}
  64. - name: make paho tests
  65. run: |
  66. if ! docker exec -i python /scripts/pytest.sh "${{ matrix.cluster_db_backend }}"; then
  67. echo "DUMP_CONTAINER_LOGS_BGN"
  68. echo "============== haproxy =============="
  69. docker logs haproxy
  70. echo "============== node1 =============="
  71. docker logs node1.emqx.io
  72. echo "============== node2 =============="
  73. docker logs node2.emqx.io
  74. echo "DUMP_CONTAINER_LOGS_END"
  75. exit 1
  76. fi
  77. helm_test:
  78. runs-on: ubuntu-20.04
  79. needs: prepare
  80. strategy:
  81. fail-fast: false
  82. matrix:
  83. profile:
  84. - emqx
  85. # - emqx-enterprise # TODO test enterprise
  86. steps:
  87. - uses: actions/download-artifact@v2
  88. with:
  89. name: source
  90. path: .
  91. - name: unzip source code
  92. run: unzip -q source.zip
  93. - name: make docker image
  94. working-directory: source
  95. env:
  96. EMQX_BUILDER: ghcr.io/emqx/emqx-builder/5.0-3:24.1.5-3-alpine3.14
  97. run: |
  98. make ${{ matrix.profile }}-docker
  99. echo "TARGET=emqx/${{ matrix.profile }}" >> $GITHUB_ENV
  100. echo "EMQX_TAG=$(./pkg-vsn.sh)" >> $GITHUB_ENV
  101. - run: minikube start
  102. - name: run emqx on chart
  103. timeout-minutes: 5
  104. working-directory: source
  105. run: |
  106. minikube image load $TARGET:$EMQX_TAG
  107. sed -i -r "s/^appVersion: .*$/appVersion: \"$EMQX_TAG\"/g" deploy/charts/emqx/Chart.yaml
  108. helm install emqx \
  109. --set image.repository=$TARGET \
  110. --set image.pullPolicy=Never \
  111. --set emqxAclConfig="" \
  112. --set image.pullPolicy=Never \
  113. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__RETRY_INTERVAL=2s \
  114. --set emqxConfig.EMQX_ZONES__DEFAULT__MQTT__MAX_TOPIC_ALIAS=10 \
  115. deploy/charts/emqx \
  116. --debug
  117. while [ "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.replicas}')" \
  118. != "$(kubectl get StatefulSet -l app.kubernetes.io/name=emqx -o jsonpath='{.items[0].status.readyReplicas}')" ]; do
  119. echo "==============================";
  120. kubectl get pods;
  121. echo "==============================";
  122. echo "waiting emqx started";
  123. sleep 10;
  124. done
  125. - name: get emqx-0 pods log
  126. if: failure()
  127. run: |
  128. kubectl describe pods emqx-0
  129. kubectl logs emqx-0
  130. - name: get emqx-1 pods log
  131. if: failure()
  132. run: |
  133. kubectl describe pods emqx-1
  134. kubectl logs emqx-1
  135. - name: get emqx-2 pods log
  136. if: failure()
  137. run: |
  138. kubectl describe pods emqx-2
  139. kubectl logs emqx-2
  140. - uses: actions/checkout@v2
  141. with:
  142. repository: emqx/paho.mqtt.testing
  143. ref: develop-4.0
  144. path: paho.mqtt.testing
  145. - name: install pytest
  146. run: |
  147. pip install pytest
  148. echo "$HOME/.local/bin" >> $GITHUB_PATH
  149. - name: run paho test
  150. run: |
  151. kubectl port-forward service/emqx 1883:1883 > /dev/null &
  152. pytest -v paho.mqtt.testing/interoperability/test_client/V5/test_connect.py -k test_basic --host "127.0.0.1"