chore: add comments for "api/healthz", clean up test env (#36481)

GITEA_UNIT_TESTS_LOG_SQL is renamed to GITEA_TEST_LOG_SQL
This commit is contained in:
wxiaoguang
2026-01-30 10:23:38 +08:00
committed by GitHub
parent 1adf8b3773
commit 07ada3666b
24 changed files with 256 additions and 323 deletions
+1 -11
View File
@@ -118,7 +118,7 @@ func PrintCurrentTest(t testing.TB, skip ...int) func() {
deferHasRun := false
t.Cleanup(func() {
if !deferHasRun {
Printf("!!! defer function hasn't been run but Cleanup is called\n%s", getRuntimeStackAll())
Printf("!!! %s defer function hasn't been run but Cleanup is called, usually caused by panic", t.Name())
}
})
Printf("=== %s (%s:%d)\n", log.NewColoredValue(t.Name()), strings.TrimPrefix(filename, prefix), line)
@@ -171,16 +171,6 @@ func Init() {
prefix = strings.TrimSuffix(filename, relFilePath)
log.RegisterEventWriter("test", newTestLoggerWriter)
duration, err := time.ParseDuration(os.Getenv("GITEA_TEST_SLOW_RUN"))
if err == nil && duration > 0 {
TestSlowRun = duration
}
duration, err = time.ParseDuration(os.Getenv("GITEA_TEST_SLOW_FLUSH"))
if err == nil && duration > 0 {
TestSlowFlush = duration
}
}
func Fatalf(format string, args ...any) {