run_cts_tests.yaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. name: Compatibility Test Suite
  2. on:
  3. push:
  4. tags:
  5. - v*
  6. release:
  7. types:
  8. - published
  9. pull_request:
  10. jobs:
  11. ldap:
  12. runs-on: ubuntu-20.04
  13. strategy:
  14. fail-fast: false
  15. matrix:
  16. ldap_tag:
  17. - 2.4.50
  18. network_type:
  19. - ipv4
  20. - ipv6
  21. steps:
  22. - uses: actions/checkout@v1
  23. - name: setup
  24. env:
  25. LDAP_TAG: ${{ matrix.ldap_tag }}
  26. run: |
  27. docker-compose -f .ci/apps_tests/docker-compose.yaml build --no-cache
  28. docker-compose -f .ci/compatibility_tests/docker-compose-ldap.yaml up -d
  29. - name: setup
  30. if: matrix.network_type == 'ipv4'
  31. run: |
  32. echo EMQX_AUTH__LDAP__SERVERS=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ldap) >> "$GITHUB_ENV"
  33. - name: setup
  34. if: matrix.network_type == 'ipv6'
  35. run: |
  36. echo EMQX_AUTH__LDAP__SERVERS=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' ldap) >> "$GITHUB_ENV"
  37. - name: run test cases
  38. run: |
  39. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  40. printenv > .env
  41. docker exec -i erlang sh -c "make ensure-rebar3"
  42. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_ldap"
  43. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_ldap"
  44. - uses: actions/upload-artifact@v1
  45. if: failure()
  46. with:
  47. name: logs_ldap${{ matrix.ldap_tag }}_${{ matrix.network_type }}
  48. path: _build/test/logs
  49. mongo:
  50. runs-on: ubuntu-20.04
  51. strategy:
  52. fail-fast: false
  53. matrix:
  54. mongo_tag:
  55. - 3
  56. - 4
  57. network_type:
  58. - ipv4
  59. - ipv6
  60. connect_type:
  61. - tls
  62. - tcp
  63. steps:
  64. - uses: actions/checkout@v1
  65. - name: setup
  66. env:
  67. MONGO_TAG: ${{ matrix.mongo_tag }}
  68. if: matrix.connect_type == 'tls'
  69. run: |
  70. docker-compose -f .ci/compatibility_tests/docker-compose-mongo-tls.yaml up -d
  71. cat <<-EOF >> "$GITHUB_ENV"
  72. EMQX_AUTH__MONGO__SSL=on
  73. EMQX_AUTH__MONGO__CACERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/ca.pem
  74. EMQX_AUTH__MONGO__CERTFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-cert.pem
  75. EMQX_AUTH__MONGO__KEYFILE=/emqx/apps/emqx_auth_mongo/test/emqx_auth_mongo_SUITE_data/client-key.pem
  76. EOF
  77. - name: setup
  78. env:
  79. MONGO_TAG: ${{ matrix.mongo_tag }}
  80. if: matrix.connect_type == 'tcp'
  81. run: |
  82. docker-compose -f .ci/compatibility_tests/docker-compose-mongo.yaml up -d
  83. echo EMQX_AUTH__MONGO__SSL=off >> "$GITHUB_ENV"
  84. - name: setup
  85. if: matrix.network_type == 'ipv4'
  86. run: |
  87. echo "EMQX_AUTH__MONGO__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mongo):27017" >> "$GITHUB_ENV"
  88. - name: setup
  89. if: matrix.network_type == 'ipv6'
  90. run: |
  91. echo "EMQX_AUTH__MONGO__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mongo):27017" >> "$GITHUB_ENV"
  92. - name: run test cases
  93. run: |
  94. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  95. printenv > .env
  96. docker exec -i erlang sh -c "make ensure-rebar3"
  97. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_mongo"
  98. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mongo"
  99. - uses: actions/upload-artifact@v1
  100. if: failure()
  101. with:
  102. name: logs_mongo${{ matrix.mongo_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  103. path: _build/test/logs
  104. mysql:
  105. runs-on: ubuntu-20.04
  106. strategy:
  107. fail-fast: false
  108. matrix:
  109. mysql_tag:
  110. - 5.7
  111. - 8
  112. network_type:
  113. - ipv4
  114. - ipv6
  115. connect_type:
  116. - tls
  117. - tcp
  118. steps:
  119. - uses: actions/checkout@v1
  120. - name: setup
  121. env:
  122. MYSQL_TAG: ${{ matrix.mysql_tag }}
  123. if: matrix.connect_type == 'tls'
  124. run: |
  125. docker-compose -f .ci/compatibility_tests/docker-compose-mysql-tls.yaml up -d
  126. cat <<-EOF >> "$GITHUB_ENV"
  127. EMQX_AUTH__MYSQL__SSL=on
  128. EMQX_AUTH__MYSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/ca.pem
  129. EMQX_AUTH__MYSQL__SSL__CERTFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-cert.pem
  130. EMQX_AUTH__MYSQL__SSL__KEYFILE=/emqx/apps/emqx_auth_mysql/test/emqx_auth_mysql_SUITE_data/client-key.pem
  131. EOF
  132. - name: setup
  133. env:
  134. MYSQL_TAG: ${{ matrix.mysql_tag }}
  135. if: matrix.connect_type == 'tcp'
  136. run: |
  137. docker-compose -f .ci/compatibility_tests/docker-compose-mysql.yaml up -d
  138. echo EMQX_AUTH__MYSQL__SSL=off >> "$GITHUB_ENV"
  139. - name: setup
  140. if: matrix.network_type == 'ipv4'
  141. run: |
  142. echo "EMQX_AUTH__MYSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql):3306" >> "$GITHUB_ENV"
  143. - name: setup
  144. if: matrix.network_type == 'ipv6'
  145. run: |
  146. echo "EMQX_AUTH__MYSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' mysql):3306" >> "$GITHUB_ENV"
  147. - name: run test cases
  148. run: |
  149. export EMQX_AUTH__MYSQL__USERNAME=root \
  150. EMQX_AUTH__MYSQL__PASSWORD=public \
  151. EMQX_AUTH__MYSQL__DATABASE=mqtt \
  152. CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  153. printenv > .env
  154. docker exec -i erlang sh -c "make ensure-rebar3"
  155. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_mysql"
  156. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_mysql"
  157. - uses: actions/upload-artifact@v1
  158. if: failure()
  159. with:
  160. name: logs_mysql${{ matrix.mysql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  161. path: _build/test/logs
  162. pgsql:
  163. runs-on: ubuntu-20.04
  164. strategy:
  165. fail-fast: false
  166. matrix:
  167. pgsql_tag:
  168. - 9
  169. - 10
  170. - 11
  171. - 12
  172. - 13
  173. network_type:
  174. - ipv4
  175. - ipv6
  176. connect_type:
  177. - tls
  178. - tcp
  179. steps:
  180. - uses: actions/checkout@v1
  181. - name: setup
  182. env:
  183. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  184. if: matrix.connect_type == 'tls'
  185. run: |
  186. docker-compose -f .ci/compatibility_tests/docker-compose-pgsql-tls.yaml build --no-cache
  187. docker-compose -f .ci/compatibility_tests/docker-compose-pgsql-tls.yaml up -d
  188. cat <<-EOF >> "$GITHUB_ENV"
  189. EMQX_AUTH__PGSQL__SSL=on
  190. EMQX_AUTH__PGSQL__SSL__CACERTFILE=/emqx/apps/emqx_auth_pgsql/test/emqx_auth_pgsql_SUITE_data/root.crt
  191. EOF
  192. - name: setup
  193. env:
  194. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  195. if: matrix.connect_type == 'tcp'
  196. run: |
  197. docker-compose -f .ci/compatibility_tests/docker-compose-pgsql.yaml up -d
  198. echo EMQX_AUTH__PGSQL__SSL=off >> "$GITHUB_ENV"
  199. - name: setup
  200. if: matrix.network_type == 'ipv4'
  201. run: |
  202. echo "EMQX_AUTH__PGSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgsql):5432" >> "$GITHUB_ENV"
  203. - name: setup
  204. if: matrix.network_type == 'ipv6'
  205. run: |
  206. echo "EMQX_AUTH__PGSQL__SERVER=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' pgsql):5432" >> "$GITHUB_ENV"
  207. - name: run test cases
  208. run: |
  209. export EMQX_AUTH__PGSQL__USERNAME=root \
  210. EMQX_AUTH__PGSQL__PASSWORD=public \
  211. EMQX_AUTH__PGSQL__DATABASE=mqtt \
  212. CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  213. printenv > .env
  214. docker exec -i erlang sh -c "make ensure-rebar3"
  215. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_pgsql"
  216. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_pgsql"
  217. - uses: actions/upload-artifact@v1
  218. if: failure()
  219. with:
  220. name: logs_pgsql${{ matrix.pgsql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  221. path: _build/test/logs
  222. redis:
  223. runs-on: ubuntu-20.04
  224. strategy:
  225. fail-fast: false
  226. matrix:
  227. redis_tag:
  228. - 5
  229. - 6
  230. network_type:
  231. - ipv4
  232. - ipv6
  233. connect_type:
  234. - tls
  235. - tcp
  236. node_type:
  237. - single
  238. - cluster
  239. steps:
  240. - uses: actions/checkout@v1
  241. - name: setup
  242. env:
  243. REDIS_TAG: ${{ matrix.redis_tag }}
  244. if: matrix.connect_type == 'tls' && matrix.redis_tag != '5'
  245. run: |
  246. set -exu
  247. docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}-tls.yaml up -d
  248. cat <<-EOF >> "$GITHUB_ENV"
  249. EMQX_AUTH__REDIS__SSL=on
  250. EMQX_AUTH__REDIS__SSL__CACERTFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/ca.crt
  251. EMQX_AUTH__REDIS__SSL__CERTFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.crt
  252. EMQX_AUTH__REDIS__SSL__KEYFILE=/emqx/apps/emqx_auth_redis/test/emqx_auth_redis_SUITE_data/certs/redis.key
  253. EOF
  254. - name: setup
  255. env:
  256. REDIS_TAG: ${{ matrix.redis_tag }}
  257. if: matrix.connect_type == 'tcp'
  258. run: |
  259. docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}.yaml up -d
  260. echo EMQX_AUTH__REDIS__SSL=off >> "$GITHUB_ENV"
  261. - name: get server address
  262. if: matrix.connect_type == 'tcp' || (matrix.connect_type == 'tls' && matrix.redis_tag != '5')
  263. run: |
  264. set -exu
  265. ipv4_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis)
  266. ipv6_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' redis)
  267. cat <<-EOF >> "$GITHUB_ENV"
  268. redis_ipv4_address=$ipv4_address
  269. redis_ipv6_address=$ipv6_address
  270. EOF
  271. - name: setup
  272. if: matrix.node_type == 'single' && matrix.connect_type == 'tcp'
  273. run: |
  274. set -exu
  275. cat <<-EOF >> "$GITHUB_ENV"
  276. EMQX_AUTH__REDIS__TYPE=single
  277. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6379
  278. EOF
  279. - name: setup
  280. if: matrix.node_type == 'single' && matrix.connect_type == 'tls' && matrix.redis_tag != '5'
  281. run: |
  282. set -exu
  283. cat <<-EOF >> "$GITHUB_ENV"
  284. EMQX_AUTH__REDIS__TYPE=single
  285. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:6380
  286. EOF
  287. - name: setup
  288. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tcp'
  289. run: |
  290. set -exu
  291. cat <<-EOF >> "$GITHUB_ENV"
  292. EMQX_AUTH__REDIS__TYPE=cluster
  293. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:7000
  294. EOF
  295. - name: setup
  296. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls' && matrix.redis_tag != '5'
  297. run: |
  298. set -exu
  299. cat <<-EOF >> "$GITHUB_ENV"
  300. EMQX_AUTH__REDIS__TYPE=cluster
  301. EMQX_AUTH__REDIS__SERVER=${redis_${{ matrix.network_type }}_address}:8000
  302. EOF
  303. - name: run test cases
  304. if: matrix.connect_type == 'tcp' || (matrix.connect_type == 'tls' && matrix.redis_tag != '5')
  305. run: |
  306. export CUTTLEFISH_ENV_OVERRIDE_PREFIX=EMQX_
  307. printenv > .env
  308. docker exec -i erlang sh -c "make ensure-rebar3"
  309. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_redis"
  310. docker exec --env-file .env -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_redis"
  311. - uses: actions/upload-artifact@v1
  312. if: failure()
  313. with:
  314. name: logs_redis${{ matrix.redis_tag }}_${{ matrix.node_type }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  315. path: _build/test/logs