Skip to content
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

tests: s/GITEA_UNIT_TESTS_VERBOSE/GITEA_UNIT_TESTS_LOG_SQL/ #18142

Merged
merged 3 commits into from
Jan 1, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion docs/content/doc/developers/hacking-on-gitea.en-us.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ There are two types of test run by Gitea: Unit tests and Integration Tests.
### Unit Tests

Unit tests are covered by `*_test.go` in `go test` system.
You can set environment variable `GITEA_UNIT_TESTS_VERBOSE=1` to see detail logs during the test.
You can set the environment variable `GITEA_UNIT_TESTS_LOG_SQL=1` to display all SQL statements when running the tests in verbose mode (i.e. when `GOTESTFLAGS=-v` is set).

```bash
TAGS="bindata sqlite sqlite_unlock_notify" make test # Runs the unit tests
Expand Down
3 changes: 2 additions & 1 deletion models/unittest/testdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/log"
6543 marked this conversation as resolved.
Show resolved Hide resolved
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/storage"
"code.gitea.io/gitea/modules/util"
Expand Down Expand Up @@ -152,7 +153,7 @@ func CreateTestEngine(opts FixturesOptions) error {
if err = db.SyncAllTables(); err != nil {
return err
}
switch os.Getenv("GITEA_UNIT_TESTS_VERBOSE") {
switch os.Getenv("GITEA_UNIT_TESTS_LOG_SQL") {
case "true", "1":
x.ShowSQL(true)
}
Expand Down