run_docker_tests.yaml 4.0 KB

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