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> (cherry picked from commit 363c1235987793dffa5cc851aaae585eb81f091e) Conflicts: options/locale/locale_en-US.ini templates/admin/self_check.tmpl trivial context conflict
This commit is contained in:
parent
40cd885c11
commit
77da92f42a
8 changed files with 93 additions and 2 deletions
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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue