run_docker_tests.yaml 4.0 KB

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