You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # Integrations tests
  2. Integration tests can be run with make commands for the
  3. appropriate backends, namely:
  4. ```shell
  5. make test-mysql
  6. make test-pgsql
  7. make test-sqlite
  8. ```
  9. Make sure to perform a clean build before running tests:
  10. ```
  11. make clean build
  12. ```
  13. ## Run all tests via local drone
  14. ```
  15. drone exec --local --build-event "pull_request"
  16. ```
  17. ## Run sqlite integrations tests
  18. Start tests
  19. ```
  20. make test-sqlite
  21. ```
  22. ## Run mysql integrations tests
  23. Setup a mysql database inside docker
  24. ```
  25. docker run -e "MYSQL_DATABASE=test" -e "MYSQL_ALLOW_EMPTY_PASSWORD=yes" -p 3306:3306 --rm --name mysql mysql:latest #(just ctrl-c to stop db and clean the container)
  26. docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" --rm --name elasticsearch elasticsearch:7.6.0 #(in a secound terminal, just ctrl-c to stop db and clean the container)
  27. ```
  28. Start tests based on the database container
  29. ```
  30. TEST_MYSQL_HOST=localhost:3306 TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=root TEST_MYSQL_PASSWORD='' make test-mysql
  31. ```
  32. ## Run pgsql integrations tests
  33. Setup a pgsql database inside docker
  34. ```
  35. docker run -e "POSTGRES_DB=test" -p 5432:5432 --rm --name pgsql postgres:latest #(just ctrl-c to stop db and clean the container)
  36. ```
  37. Start tests based on the database container
  38. ```
  39. TEST_PGSQL_HOST=localhost:5432 TEST_PGSQL_DBNAME=test TEST_PGSQL_USERNAME=postgres TEST_PGSQL_PASSWORD=postgres make test-pgsql
  40. ```
  41. ## Run mssql integrations tests
  42. Setup a mssql database inside docker
  43. ```
  44. docker run -e "ACCEPT_EULA=Y" -e "MSSQL_PID=Standard" -e "SA_PASSWORD=MwantsaSecurePassword1" -p 1433:1433 --rm --name mssql microsoft/mssql-server-linux:latest #(just ctrl-c to stop db and clean the container)
  45. ```
  46. Start tests based on the database container
  47. ```
  48. TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=gitea_test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql
  49. ```
  50. ## Running individual tests
  51. Example command to run GPG test:
  52. For sqlite:
  53. ```
  54. make test-sqlite#GPG
  55. ```
  56. For other databases(replace MSSQL to MYSQL, MYSQL8, PGSQL):
  57. ```
  58. TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql#GPG
  59. ```