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 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Integrations tests
  2. Integration tests can be run with make commands for the
  3. appropriate backends, namely:
  4. make test-mysql
  5. make test-pgsql
  6. make test-sqlite
  7. Make sure to perform a clean build before running tests:
  8. make clean build
  9. ## Run all tests via local drone
  10. ```
  11. drone exec --local --build-event "pull_request"
  12. ```
  13. ## Run sqlite integrations tests
  14. Start tests
  15. ```
  16. make test-sqlite
  17. ```
  18. ## Run mysql integrations tests
  19. Setup a mysql database inside docker
  20. ```
  21. docker run -e "MYSQL_DATABASE=test" -e "MYSQL_ALLOW_EMPTY_PASSWORD=yes" --rm --name mysql mysql:5.7 #(just ctrl-c to stop db and clean the container)
  22. ```
  23. Start tests based on the database container
  24. ```
  25. TEST_MYSQL_HOST="$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql):3306" TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=root TEST_MYSQL_PASSWORD='' make test-mysql
  26. ```
  27. ## Run pgsql integrations tests
  28. Setup a pgsql database inside docker
  29. ```
  30. docker run -e "POSTGRES_DB=test" --rm --name pgsql postgres:9.5 #(just ctrl-c to stop db and clean the container)
  31. ```
  32. Start tests based on the database container
  33. ```
  34. TEST_PGSQL_HOST=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgsql) TEST_PGSQL_DBNAME=test TEST_PGSQL_USERNAME=postgres TEST_PGSQL_PASSWORD=postgres make test-pgsql
  35. ```
  36. ## Running individual tests
  37. Example command to run GPG test with sqlite backend:
  38. ```
  39. go test -c code.gitea.io/gitea/integrations \
  40. -o integrations.sqlite.test -tags 'sqlite' &&
  41. GITEA_ROOT="$GOPATH/src/code.gitea.io/gitea" \
  42. GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test \
  43. -test.v -test.run GPG
  44. ```