run_docker_tests.yaml 3.9 KB

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