mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-23 17:40:39 +00:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user