test: speed up tests, fix transaction bug (#39030)

Speed up tests: `make test-backend` 103s to 37s, `make test-integration`
908s to 852s.

Most of it is a detached system notice insert blocking on the SQLite
write lock until the busy timeout expired, and `ExternalServiceHTTP`
re-probing on every call with an untimed `http.Get`.

- fixed one correctness bug with nested transactions: files were deleted
while the outer transaction was open, so a later failure could roll the
database back with the files gone
- git push branch counts were far above the hook batch size
- Fix makefile dependencies so running tests and lint work in fresh
worktrees.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
silverwind
2026-08-22 13:04:35 +02:00
committed by GitHub
parent cce2360846
commit 66d6f74cb0
8 changed files with 69 additions and 29 deletions
+9 -1
View File
@@ -91,13 +91,21 @@ func main() {
_, _ = fmt.Fprintln(os.Stdout, "lint go header ...")
succeed := lintGoHeader()
_, _ = fmt.Fprintln(os.Stdout, "lint for linux ...")
succeed = runCmd([]string{"GOOS=linux", "TAGS=bindata"}, "golangci-lint", append([]string{"run", "--build-tags=linux,bindata"}, os.Args[1:]...)) && succeed
lintTagsLinux := ""
if os.Getenv("CI") != "" || strings.Contains(os.Getenv("TAGS"), "bindata") {
// also lint with bindata tag if we are in CI or the "bindata" is explicitly set in the env TAGS
lintTagsLinux = "bindata"
}
succeed = runCmd([]string{"GOOS=linux", "TAGS=" + lintTagsLinux}, "golangci-lint", append([]string{"run", "--build-tags=linux," + lintTagsLinux}, os.Args[1:]...)) && succeed
if os.Getenv("CI") != "" {
// only lint for other platforms when in CI, to keep local lint fast
_, _ = fmt.Fprintln(os.Stdout, "lint for windows ...")
succeed = runCmd([]string{"GOOS=windows", "TAGS=gogit"}, "golangci-lint", append([]string{"run", "--build-tags=windows,gogit"}, os.Args[1:]...)) && succeed
}
if !succeed {
os.Exit(1)
}