run_docker_tests.yaml 3.8 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. 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. jobs:
  18. basic-tests:
  19. runs-on: ${{ fromJSON(inputs.runner_labels) }}
  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: ${{ fromJSON(inputs.runner_labels) }}
  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: actions/checkout@v3
  80. - uses: actions/download-artifact@v3
  81. with:
  82. name: ${{ env.EMQX_NAME }}-docker
  83. path: /tmp
  84. - name: load docker image
  85. run: |
  86. EMQX_IMAGE_TAG=$(docker load < /tmp/${EMQX_NAME}-docker-${PKG_VSN}.tar.gz 2>/dev/null | sed 's/Loaded image: //g')
  87. echo "_EMQX_DOCKER_IMAGE_TAG=$EMQX_IMAGE_TAG" >> $GITHUB_ENV
  88. - name: run emqx
  89. timeout-minutes: 5
  90. run: |
  91. ./.ci/docker-compose-file/scripts/run-emqx.sh $_EMQX_DOCKER_IMAGE_TAG $_EMQX_TEST_DB_BACKEND
  92. - name: make paho tests
  93. run: |
  94. if ! docker exec -i python /scripts/pytest.sh "$_EMQX_TEST_DB_BACKEND"; then
  95. echo "DUMP_CONTAINER_LOGS_BGN"
  96. echo "============== haproxy =============="
  97. docker logs haproxy
  98. echo "============== node1 =============="
  99. docker logs node1.emqx.io
  100. echo "============== node2 =============="
  101. docker logs node2.emqx.io
  102. echo "DUMP_CONTAINER_LOGS_END"
  103. exit 1
  104. fi
  105. # simple smoke test for node_dump
  106. - name: test node_dump
  107. run: |
  108. docker exec -t -u root node1.emqx.io bash -c 'apt-get -y update && apt-get -y install net-tools'
  109. docker exec node1.emqx.io node_dump