diff options
author | Earl Warren <109468362+earl-warren@users.noreply.github.com> | 2023-08-01 19:57:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-01 17:57:11 +0000 |
commit | b1089bdafef1dfb62ecbac99665ac7f7fd5eddce (patch) | |
tree | 909940ef85183d327cf8142011a1123b5dc2f894 /tests | |
parent | 6ed4626ed594f8b7f0328d45c174c1b14144862a (diff) | |
download | gitea-b1089bdafef1dfb62ecbac99665ac7f7fd5eddce.tar.gz gitea-b1089bdafef1dfb62ecbac99665ac7f7fd5eddce.zip |
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 <postmaster@gusted.xyz>
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_utils.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/test_utils.go b/tests/test_utils.go index fc4247eba8..3bcd872d6c 100644 --- a/tests/test_utils.go +++ b/tests/test_utils.go @@ -12,6 +12,7 @@ import ( "path" "path/filepath" "testing" + "time" "code.gitea.io/gitea/models/db" packages_model "code.gitea.io/gitea/models/packages" @@ -43,6 +44,9 @@ func InitTest(requireGitea bool) { exitf("Environment variable $GITEA_ROOT not set") } + // Speedup tests that rely on the event source ticker. + setting.UI.Notification.EventSourceUpdateTime = time.Second + setting.IsInTesting = true setting.AppWorkPath = giteaRoot setting.CustomPath = filepath.Join(setting.AppWorkPath, "custom") |