run_cts_tests.yaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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. sed -i 's|^[#[:space:]]*auth.pgsql.username[ \t]*=.*|auth.pgsql.username = root|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
  186. sed -i 's|^[#[:space:]]*auth.pgsql.password[ \t]*=.*|auth.pgsql.password = public|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
  187. sed -i 's|^[#[:space:]]*auth.pgsql.database[ \t]*=.*|auth.pgsql.database = mqtt|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
  188. sed -i 's|^[#[:space:]]*auth.pgsql.ssl[ \t]*=.*|auth.pgsql.ssl = on|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
  189. 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
  190. - name: setup
  191. env:
  192. PGSQL_TAG: ${{ matrix.pgsql_tag }}
  193. if: matrix.connect_type == 'tcp'
  194. run: |
  195. docker-compose -f .ci/compatibility_tests/docker-compose-pgsql.yaml up -d
  196. sed -i 's|^[#[:space:]]*auth.pgsql.username[ \t]*=.*|auth.pgsql.username = root|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
  197. sed -i 's|^[#[:space:]]*auth.pgsql.password[ \t]*=.*|auth.pgsql.password = public|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
  198. sed -i 's|^[#[:space:]]*auth.pgsql.database[ \t]*=.*|auth.pgsql.database = mqtt|g' apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
  199. - name: setup
  200. if: matrix.network_type == 'ipv4'
  201. run: |
  202. server_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgsql)
  203. sed -i "s|^[#[:space:]]*auth.pgsql.server[[:space:]]*=.*|auth.pgsql.server = $server_address:5432|g" apps/emqx_auth_pgsql/etc/emqx_auth_pgsql.conf
  204. - name: setup
  205. if: matrix.network_type == 'ipv6'
  206. run: |
  207. server_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{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: run test cases
  210. run: |
  211. docker exec -i erlang sh -c "make ensure-rebar3"
  212. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_pgsql"
  213. docker exec -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_pgsql"
  214. - uses: actions/upload-artifact@v1
  215. if: failure()
  216. with:
  217. name: logs_pgsql${{ matrix.pgsql_tag }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  218. path: _build/test/logs
  219. redis:
  220. runs-on: ubuntu-20.04
  221. strategy:
  222. fail-fast: false
  223. matrix:
  224. redis_tag:
  225. - 5
  226. - 6
  227. network_type:
  228. - ipv4
  229. - ipv6
  230. connect_type:
  231. - tls
  232. - tcp
  233. node_type:
  234. - single
  235. - cluster
  236. steps:
  237. - uses: actions/checkout@v1
  238. - name: setup
  239. env:
  240. REDIS_TAG: ${{ matrix.redis_tag }}
  241. if: matrix.connect_type == 'tls' && matrix.redis_tag != '5'
  242. run: |
  243. set -exu
  244. docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}-tls.yaml up -d
  245. sed -i 's|^[#[:space:]]*auth.redis.ssl[[:space:]]*=.*|auth.redis.ssl = on|g' apps/emqx_auth_redis/etc/emqx_auth_redis.conf
  246. 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
  247. 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
  248. 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
  249. - name: setup
  250. env:
  251. REDIS_TAG: ${{ matrix.redis_tag }}
  252. if: matrix.connect_type == 'tcp'
  253. run: docker-compose -f .ci/compatibility_tests/docker-compose-redis-${{ matrix.node_type }}.yaml up -d
  254. - name: get server address
  255. if: matrix.connect_type == 'tcp' || (matrix.connect_type == 'tls' && matrix.redis_tag != '5')
  256. run: |
  257. set -exu
  258. ipv4_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' redis)
  259. ipv6_address=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.GlobalIPv6Address}}{{end}}' redis)
  260. echo "redis_ipv4_address=$ipv4_address" >> $GITHUB_ENV
  261. echo "redis_ipv6_address=$ipv6_address" >> $GITHUB_ENV
  262. - name: setup
  263. if: matrix.node_type == 'single' && matrix.connect_type == 'tcp'
  264. run: |
  265. set -exu
  266. 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
  267. - name: setup
  268. if: matrix.node_type == 'single' && matrix.connect_type == 'tls' && matrix.redis_tag != '5'
  269. run: |
  270. set -exu
  271. 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
  272. - name: setup
  273. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tcp'
  274. run: |
  275. set -exu
  276. sed -i 's|^[#[:space:]]*auth.redis.type[[:space:]]*=.*|auth.redis.type = cluster|g' apps/emqx_auth_redis/etc/emqx_auth_redis.conf
  277. 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
  278. - name: setup
  279. if: matrix.node_type == 'cluster' && matrix.connect_type == 'tls' && matrix.redis_tag != '5'
  280. run: |
  281. set -exu
  282. sed -i 's|^[#[:space:]]*auth.redis.type[[:space:]]*=.*|auth.redis.type = cluster|g' apps/emqx_auth_redis/etc/emqx_auth_redis.conf
  283. 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
  284. - name: run test cases
  285. if: matrix.connect_type == 'tcp' || (matrix.connect_type == 'tls' && matrix.redis_tag != '5')
  286. run: |
  287. docker exec -i erlang sh -c "make ensure-rebar3"
  288. docker exec -i erlang sh -c "./rebar3 eunit --dir apps/emqx_auth_redis"
  289. docker exec -i erlang sh -c "./rebar3 ct --dir apps/emqx_auth_redis"
  290. - uses: actions/upload-artifact@v1
  291. if: failure()
  292. with:
  293. name: logs_redis${{ matrix.redis_tag }}_${{ matrix.node_type }}_${{ matrix.network_type }}_${{ matrix.connect_type }}
  294. path: _build/test/logs