run_docker_tests.yaml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. permissions:
  8. contents: read
  9. jobs:
  10. basic-tests:
  11. runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
  12. defaults:
  13. run:
  14. shell: bash
  15. strategy:
  16. fail-fast: false
  17. matrix:
  18. profile:
  19. - ["emqx", "emqx/emqx:5.0.16"]
  20. - ["emqx-enterprise", "emqx/emqx-enterprise:5.0.1"]
  21. env:
  22. EMQX_NAME: ${{ matrix.profile[0] }}
  23. EMQX_IMAGE_OLD_VERSION_TAG: ${{ matrix.profile[1] }}
  24. steps:
  25. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
  26. - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
  27. with:
  28. name: ${{ env.EMQX_NAME }}-docker
  29. - name: load docker image
  30. run: |
  31. EMQX_TAG=$(docker load < ${EMQX_NAME}-docker-*.tar.gz 2>/dev/null | sed 's/Loaded image: //g')
  32. echo "_EMQX_DOCKER_IMAGE_TAG=$EMQX_TAG" >> $GITHUB_ENV
  33. - name: dashboard tests
  34. working-directory: ./scripts/ui-tests
  35. run: |
  36. set -eu
  37. docker compose up --abort-on-container-exit --exit-code-from selenium
  38. - name: test two nodes cluster with proto_dist=inet_tls in docker
  39. run: |
  40. ## -d 1 means only put node 1 (latest version) behind haproxy
  41. ./scripts/test/start-two-nodes-in-docker.sh -d 1 -P $_EMQX_DOCKER_IMAGE_TAG $EMQX_IMAGE_OLD_VERSION_TAG
  42. HTTP_PORT=$(docker inspect --format='{{(index (index .NetworkSettings.Ports "18083/tcp") 0).HostPort}}' haproxy)
  43. ./scripts/test/emqx-smoke-test.sh localhost $HTTP_PORT
  44. ## -c menas 'cleanup'
  45. ./scripts/test/start-two-nodes-in-docker.sh -c
  46. - name: cleanup
  47. if: always()
  48. working-directory: ./scripts/ui-tests
  49. run: |
  50. docker compose rm -fs
  51. paho-mqtt-testing:
  52. runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
  53. defaults:
  54. run:
  55. shell: bash
  56. env:
  57. EMQX_NAME: ${{ matrix.profile }}
  58. _EMQX_TEST_DB_BACKEND: ${{ matrix.profile == 'emqx-enterprise' && 'rlog' || 'mnesia' }}
  59. strategy:
  60. fail-fast: false
  61. matrix:
  62. profile:
  63. - emqx
  64. - emqx-enterprise
  65. - emqx-elixir
  66. steps:
  67. - uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
  68. - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
  69. with:
  70. name: ${{ env.EMQX_NAME }}-docker
  71. - name: load docker image
  72. run: |
  73. EMQX_TAG=$(docker load < ${EMQX_NAME}-docker-*.tar.gz 2>/dev/null | sed 's/Loaded image: //g')
  74. echo "_EMQX_DOCKER_IMAGE_TAG=$EMQX_TAG" >> $GITHUB_ENV
  75. - name: run emqx
  76. timeout-minutes: 5
  77. run: |
  78. ./.ci/docker-compose-file/scripts/run-emqx.sh $_EMQX_DOCKER_IMAGE_TAG $_EMQX_TEST_DB_BACKEND
  79. - name: make paho tests
  80. run: |
  81. if ! docker exec -i python /scripts/pytest.sh "$_EMQX_TEST_DB_BACKEND"; then
  82. echo "DUMP_CONTAINER_LOGS_BGN"
  83. echo "============== haproxy =============="
  84. docker logs haproxy
  85. echo "============== node1 =============="
  86. docker logs node1.emqx.io
  87. echo "============== node2 =============="
  88. docker logs node2.emqx.io
  89. echo "DUMP_CONTAINER_LOGS_END"
  90. exit 1
  91. fi
  92. # simple smoke test for node_dump
  93. - name: test node_dump
  94. run: |
  95. docker exec -t -u root node1.emqx.io bash -c 'apt-get -y update && apt-get -y install net-tools'
  96. docker exec -t -u root node1.emqx.io node_dump