run_docker_tests.yaml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. name: Docker image tests
  2. concurrency:
  3. group: docker-tests-${{ github.event_name }}-${{ github.ref }}
  4. cancel-in-progress: true
  5. on:
  6. workflow_call:
  7. inputs:
  8. runner:
  9. required: true
  10. type: string
  11. version-emqx:
  12. required: true
  13. type: string
  14. version-emqx-enterprise:
  15. required: true
  16. type: string
  17. jobs:
  18. basic-tests:
  19. runs-on: ${{ inputs.runner }}
  20. defaults:
  21. run:
  22. shell: bash
  23. strategy:
  24. fail-fast: false
  25. matrix:
  26. profile:
  27. - ["emqx", "emqx/emqx:5.0.16"]
  28. - ["emqx-enterprise", "emqx/emqx-enterprise:5.0.1"]
  29. env:
  30. EMQX_NAME: ${{ matrix.profile[0] }}
  31. PKG_VSN: ${{ matrix.profile[0] == 'emqx-enterprise' && inputs.version-emqx-enterprise || inputs.version-emqx }}
  32. EMQX_IMAGE_OLD_VERSION_TAG: ${{ matrix.profile[1] }}
  33. steps:
  34. - uses: actions/checkout@v3
  35. - uses: actions/download-artifact@v3
  36. with:
  37. name: ${{ env.EMQX_NAME }}-docker
  38. path: /tmp
  39. - name: load docker image
  40. run: |
  41. EMQX_IMAGE_TAG=$(docker load < /tmp/${EMQX_NAME}-docker-${PKG_VSN}.tar.gz 2>/dev/null | sed 's/Loaded image: //g')
  42. echo "EMQX_IMAGE_TAG=$EMQX_IMAGE_TAG" >> $GITHUB_ENV
  43. - name: dashboard tests
  44. working-directory: ./scripts/ui-tests
  45. run: |
  46. set -eu
  47. docker compose up --abort-on-container-exit --exit-code-from selenium
  48. - name: test two nodes cluster with proto_dist=inet_tls in docker
  49. run: |
  50. ./scripts/test/start-two-nodes-in-docker.sh -P $EMQX_IMAGE_TAG $EMQX_IMAGE_OLD_VERSION_TAG
  51. HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' haproxy)
  52. ./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
  53. ./scripts/test/start-two-nodes-in-docker.sh -c
  54. - name: cleanup
  55. if: always()
  56. working-directory: ./scripts/ui-tests
  57. run: |
  58. docker compose rm -fs
  59. paho-mqtt-testing:
  60. runs-on: ${{ inputs.runner }}
  61. defaults:
  62. run:
  63. shell: bash
  64. env:
  65. EMQX_NAME: ${{ matrix.profile }}
  66. PKG_VSN: ${{ matrix.profile == 'emqx-enterprise' && inputs.version-emqx-enterprise || inputs.version-emqx }}
  67. _EMQX_TEST_DB_BACKEND: ${{ matrix.cluster_db_backend }}
  68. strategy:
  69. fail-fast: false
  70. matrix:
  71. profile:
  72. - emqx
  73. - emqx-enterprise
  74. - emqx-elixir
  75. cluster_db_backend:
  76. - mnesia
  77. - rlog
  78. steps:
  79. - uses: AutoModality/action-clean@v1
  80. - uses: actions/checkout@v3
  81. - uses: actions/download-artifact@v3
  82. with:
  83. name: ${{ env.EMQX_NAME }}-docker
  84. path: /tmp
  85. - name: load docker image
  86. run: |
  87. EMQX_IMAGE_TAG=$(docker load < /tmp/${EMQX_NAME}-docker-${PKG_VSN}.tar.gz 2>/dev/null | sed 's/Loaded image: //g')
  88. echo "_EMQX_DOCKER_IMAGE_TAG=$EMQX_IMAGE_TAG" >> $GITHUB_ENV
  89. - name: run emqx
  90. timeout-minutes: 5
  91. run: |
  92. ./.ci/docker-compose-file/scripts/run-emqx.sh $_EMQX_DOCKER_IMAGE_TAG $_EMQX_TEST_DB_BACKEND
  93. - name: make paho tests
  94. run: |
  95. if ! docker exec -i python /scripts/pytest.sh "$_EMQX_TEST_DB_BACKEND"; then
  96. echo "DUMP_CONTAINER_LOGS_BGN"
  97. echo "============== haproxy =============="
  98. docker logs haproxy
  99. echo "============== node1 =============="
  100. docker logs node1.emqx.io
  101. echo "============== node2 =============="
  102. docker logs node2.emqx.io
  103. echo "DUMP_CONTAINER_LOGS_END"
  104. exit 1
  105. fi
  106. # node_dump requires netstat, which is not available in the container
  107. # simple smoke test for node_dump
  108. # - name: test node_dump
  109. # run: |
  110. # docker exec -u root node1.emqx.io apt update && apt install -y net-tools
  111. # docker exec node1.emqx.io node_dump