Skip to content

Commit

Permalink
speed up TestEventSourceManagerRun (go-gitea#26262)
Browse files Browse the repository at this point in the history
- `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>
  • Loading branch information
3 people authored Aug 1, 2023
1 parent 6ed4626 commit b1089bd
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"path"
"path/filepath"
"testing"
"time"

"code.gitea.io/gitea/models/db"
packages_model "code.gitea.io/gitea/models/packages"
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit b1089bd

Please sign in to comment.