Skip to content

CN translation of Integrations tests #5050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 15, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions integrations/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

Integration tests can be run with make commands for the
appropriate backends, namely:

make test-mysql
make test-pgsql
make test-sqlite
```shell
make test-mysql
make test-pgsql
make test-sqlite
```

Make sure to perform a clean build before running tests:

make clean build
```
make clean build
```

## Run all tests via local drone
```
Expand Down Expand Up @@ -45,7 +47,6 @@ TEST_PGSQL_HOST=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAdd
## Running individual tests

Example command to run GPG test with sqlite backend:

```
go test -c code.gitea.io/gitea/integrations \
-o integrations.sqlite.test -tags 'sqlite' &&
Expand Down
56 changes: 56 additions & 0 deletions integrations/README_ZH.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# 关于集成测试

使用如下 make 命令可以运行指定的集成测试:
```shell
make test-mysql
make test-pgsql
make test-sqlite
```

在执行集成测试命令前请确保清理了之前的构建环境,清理命令如下:
```
make clean build
```

## 如何在本地 drone 服务器上运行所有测试
```
drone exec --local --build-event "pull_request"
```

## 如何使用 sqlite 数据库进行集成测试
使用该命令执行集成测试
```
make test-sqlite
```

## 如何使用 mysql 数据库进行集成测试
首先在docker容器里部署一个 mysql 数据库
```
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)
```
之后便可以基于这个数据库进行集成测试
```
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
```

## 如何使用 pgsql 数据库进行集成测试
同上,首先在 docker 容器里部署一个 pgsql 数据库
```
docker run -e "POSTGRES_DB=test" --rm --name pgsql postgres:9.5 #(just ctrl-c to stop db and clean the 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
```

## 如何进行自定义的集成测试

下面的示例展示了怎样基于 sqlite 数据库进行 GPG 测试:
```
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
```