run_fvt_tests.yaml 4.6 KB

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