Skip to content

Commit 1028ef2

Browse files
ethantkoeniglafriks
authored andcommitted
Don't print SQL in unit tests (#2995)
* Add GITEA_UNIT_TESTS_VERBOSE environment variable to enable printing SQL
1 parent 8b58772 commit 1028ef2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

models/unit_tests.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ func CreateTestEngine(fixturesDir string) error {
3232
if err = x.StoreEngine("InnoDB").Sync2(tables...); err != nil {
3333
return err
3434
}
35-
x.ShowSQL(true)
35+
switch os.Getenv("GITEA_UNIT_TESTS_VERBOSE") {
36+
case "true", "1":
37+
x.ShowSQL(true)
38+
}
3639

3740
return InitFixtures(&testfixtures.SQLite{}, fixturesDir)
3841
}

0 commit comments

Comments
 (0)