run_cts_tests.yaml 15 KB

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