diff options
author | 6543 <6543@obermui.de> | 2024-06-17 21:22:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-17 21:22:39 +0200 |
commit | 363c1235987793dffa5cc851aaae585eb81f091e (patch) | |
tree | 0663c2a90a25b0578925c711e7e69c2d6814a060 /modules/cache/cache_test.go | |
parent | 4b6eb46e69e460ad81e61f67e468a0f365cbd6a6 (diff) | |
download | gitea-363c1235987793dffa5cc851aaae585eb81f091e.tar.gz gitea-363c1235987793dffa5cc851aaae585eb81f091e.zip |
Add cache test for admins (#31265)
Add a test to probe the cache similar to the email test func.
![image](https://github.com/go-gitea/gitea/assets/24977596/700e2733-586d-4091-900f-f5f71e6e94bf)
![image](https://github.com/go-gitea/gitea/assets/24977596/2a953802-18fc-4e81-a37d-24ebe1297365)
![image](https://github.com/go-gitea/gitea/assets/24977596/e00d62ad-bb60-41cc-9138-09993daee156)
---------
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: silverwind <me@silverwind.io>
Diffstat (limited to 'modules/cache/cache_test.go')
-rw-r--r-- | modules/cache/cache_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/cache/cache_test.go b/modules/cache/cache_test.go index 0c68cc26ee..e0b82f86f2 100644 --- a/modules/cache/cache_test.go +++ b/modules/cache/cache_test.go @@ -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() |