run_cts_tests.yaml 14 KB

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