summaryrefslogtreecommitdiffstats
path: root/integrations/README.md
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-09-25 20:13:18 +0800
committerAntoine GIRARD <sapk@users.noreply.github.com>2019-09-25 14:13:18 +0200
commita8c024043ca7a762c29e3ed97b791df541b219d9 (patch)
treecae62a5a902695acf9cd82b5981c381850872c20 /integrations/README.md
parentc05b89a5aaea7c3a7db9b602693556cde725a30f (diff)
downloadgitea-a8c024043ca7a762c29e3ed97b791df541b219d9.tar.gz
gitea-a8c024043ca7a762c29e3ed97b791df541b219d9.zip
Improve integration tests (#8276)
* improve integration tests * fix Makefile * improve makefile and integration docs
Diffstat (limited to 'integrations/README.md')
-rw-r--r--integrations/README.md34
1 files changed, 24 insertions, 10 deletions
diff --git a/integrations/README.md b/integrations/README.md
index a88cec6e4f..6ffd76815c 100644
--- a/integrations/README.md
+++ b/integrations/README.md
@@ -27,31 +27,45 @@ make test-sqlite
## Run mysql integrations tests
Setup a mysql database inside docker
```
-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)
+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)
```
Start tests based on the database container
```
-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
+TEST_MYSQL_HOST=localhost:3306 TEST_MYSQL_DBNAME=test TEST_MYSQL_USERNAME=root TEST_MYSQL_PASSWORD='' make test-mysql
```
## Run pgsql integrations tests
Setup a pgsql database inside docker
```
-docker run -e "POSTGRES_DB=test" --rm --name pgsql postgres:9.5 #(just ctrl-c to stop db and clean the container)
+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)
```
Start tests based on the database container
```
-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
+TEST_PGSQL_HOST=localhost:5432 TEST_PGSQL_DBNAME=test TEST_PGSQL_USERNAME=postgres TEST_PGSQL_PASSWORD=postgres make test-pgsql
+```
+
+## Run mssql integrations tests
+Setup a mssql database inside docker
+```
+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)
+```
+Start tests based on the database container
+```
+TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=gitea_test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql
```
## Running individual tests
-Example command to run GPG test with sqlite backend:
+Example command to run GPG test:
+
+For sqlite:
+
```
-go test -c code.gitea.io/gitea/integrations \
- -o integrations.sqlite.test -tags 'sqlite' &&
- GITEA_ROOT="$GOPATH/src/code.gitea.io/gitea" \
- GITEA_CONF=integrations/sqlite.ini ./integrations.sqlite.test \
- -test.v -test.run GPG
+make test-sqlite#GPG
```
+For other databases(replace MSSQL to MYSQL, MYSQL8, PGSQL):
+
+```
+TEST_MSSQL_HOST=localhost:1433 TEST_MSSQL_DBNAME=test TEST_MSSQL_USERNAME=sa TEST_MSSQL_PASSWORD=MwantsaSecurePassword1 make test-mssql#GPG
+``` \ No newline at end of file