Skip to content

Commit b1089bd

Browse files
earl-warrenGustedGiteaBot
authored
speed up TestEventSourceManagerRun (#26262)
- `setting.UI.Notification.EventSourceUpdateTime` is by default 10 seconds, which adds an 10 second delay before the test succeeds. - Lower the interval to reduce it to at most 3 second delay (the code only send events when they are at least 2 seconds old). (cherry picked from commit 3adb9ae6009ff3ddebaed4875e086343f668ef7b) Refs: https://codeberg.org/forgejo/forgejo/pulls/1166 Co-authored-by: Gusted <[email protected]> Co-authored-by: Giteabot <[email protected]>
1 parent 6ed4626 commit b1089bd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/test_utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"path"
1313
"path/filepath"
1414
"testing"
15+
"time"
1516

1617
"code.gitea.io/gitea/models/db"
1718
packages_model "code.gitea.io/gitea/models/packages"
@@ -43,6 +44,9 @@ func InitTest(requireGitea bool) {
4344
exitf("Environment variable $GITEA_ROOT not set")
4445
}
4546

47+
// Speedup tests that rely on the event source ticker.
48+
setting.UI.Notification.EventSourceUpdateTime = time.Second
49+
4650
setting.IsInTesting = true
4751
setting.AppWorkPath = giteaRoot
4852
setting.CustomPath = filepath.Join(setting.AppWorkPath, "custom")

0 commit comments

Comments
 (0)