File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,15 @@ func Init() error {
3737}
3838
3939const (
40- testCacheKey = "DefaultCache.TestKey"
41- SlowCacheThreshold = 100 * time .Microsecond
40+ testCacheKey = "DefaultCache.TestKey"
41+ // SlowCacheThreshold marks cache tests as slow
42+ // set to 30ms per discussion: https://github.com/go-gitea/gitea/issues/33190
43+ // TODO: Replace with metrics histogram
44+ SlowCacheThreshold = 30 * time .Millisecond
4245)
4346
47+ // Test performs delete, put and get operations on a predefined key
48+ // returns
4449func Test () (time.Duration , error ) {
4550 if defaultCache == nil {
4651 return 0 , fmt .Errorf ("default cache not initialized" )
Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ func TestTest(t *testing.T) {
4343 elapsed , err := Test ()
4444 assert .NoError (t , err )
4545 // mem cache should take from 300ns up to 1ms on modern hardware ...
46- assert .Less (t , elapsed , time .Millisecond )
46+ assert .Positive (t , elapsed )
47+ assert .Less (t , elapsed , SlowCacheThreshold )
4748}
4849
4950func TestGetCache (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments