Skip to content

Commit 36a94da

Browse files
sapklafriks
authored andcommitted
doc: Improve integrations examples (go-gitea#3416)
1 parent bcd7f42 commit 36a94da

File tree

1 file changed

+38
-4
lines changed

1 file changed

+38
-4
lines changed

integrations/README.md

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,48 @@
1+
# Integrations tests
2+
13
Integration tests can be run with make commands for the
24
appropriate backends, namely:
35

46
make test-mysql
57
make test-pgsql
68
make test-sqlite
79

8-
# Running individual tests
10+
Make sure to perform a clean build before running tests:
11+
12+
make clean build
13+
14+
## Run all tests via local drone
15+
```
16+
drone exec --local --build.event "pull_request"
17+
```
18+
19+
## Run sqlite integrations tests
20+
Start tests
21+
```
22+
make test-sqlite
23+
```
24+
25+
## Run mysql integrations tests
26+
Setup a mysql database inside docker
27+
```
28+
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)
29+
```
30+
Start tests based on the database container
31+
```
32+
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
33+
```
34+
35+
## Run pgsql integrations tests
36+
Setup a pgsql database inside docker
37+
```
38+
docker run -e "POSTGRES_DB=test" --rm --name pgsql postgres:9.5 #(just ctrl-c to stop db and clean the container)
39+
```
40+
Start tests based on the database container
41+
```
42+
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
43+
```
44+
45+
## Running individual tests
946

1047
Example command to run GPG test with sqlite backend:
1148

@@ -17,6 +54,3 @@ go test -c code.gitea.io/gitea/integrations \
1754
-test.v -test.run GPG
1855
```
1956

20-
Make sure to perform a clean build before running tests:
21-
22-
make clean build

0 commit comments

Comments
 (0)