mirror of
https://github.com/go-gitea/gitea
synced 2025-07-07 19:17:21 +00:00
Add cache test for admins (#31265)
Add a test to probe the cache similar to the email test func.    --------- Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
12
modules/cache/cache_test.go
vendored
12
modules/cache/cache_test.go
vendored
@ -34,6 +34,18 @@ func TestNewContext(t *testing.T) {
|
||||
assert.Nil(t, con)
|
||||
}
|
||||
|
||||
func TestTest(t *testing.T) {
|
||||
defaultCache = nil
|
||||
_, err := Test()
|
||||
assert.Error(t, err)
|
||||
|
||||
createTestCache()
|
||||
elapsed, err := Test()
|
||||
assert.NoError(t, err)
|
||||
// mem cache should take from 300ns up to 1ms on modern hardware ...
|
||||
assert.Less(t, elapsed, SlowCacheThreshold)
|
||||
}
|
||||
|
||||
func TestGetCache(t *testing.T) {
|
||||
createTestCache()
|
||||
|
||||
|
Reference in New Issue
Block a user