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.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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:5.7 #(just ctrl-c to stop db and clean the container)
  26. ```
  27. Start tests based on the database container
  28. ```
  29. TEST_MYSQL_HOST=localhost:3306 TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=root TEST_MYSQL_PASSWORD='' make test-mysql
  30. ```
  31. ## Run pgsql integrations tests
  32. Setup a pgsql database inside docker
  33. ```
  34. docker run -e "POSTGRES_DB=test" -p 5432:5432 --rm --name pgsql postgres:9.5 #(just ctrl-c to stop db and clean the container)
  35. ```
  36. Start tests based on the database container
  37. ```
  38. TEST_PGSQL_HOST=localhost:5432 TEST_PGSQL_DBNAME=test TEST_PGSQL_USERNAME=postgres TEST_PGSQL_PASSWORD=postgres make test-pgsql
  39. ```
  40. ## Run mssql integrations tests
  41. Setup a mssql database inside docker
  42. ```
  43. 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)
  44. ```
  45. Start tests based on the database container
  46. ```
  47. TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=gitea_test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql
  48. ```
  49. ## Running individual tests
  50. Example command to run GPG test:
  51. For sqlite:
  52. ```
  53. make test-sqlite#GPG
  54. ```
  55. For other databases(replace MSSQL to MYSQL, MYSQL8, PGSQL):
  56. ```
  57. TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql#GPG
  58. ```