File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -37,10 +37,15 @@ func Init() error {
37
37
}
38
38
39
39
const (
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
42
45
)
43
46
47
+ // Test performs delete, put and get operations on a predefined key
48
+ // returns
44
49
func Test () (time.Duration , error ) {
45
50
if defaultCache == nil {
46
51
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) {
43
43
elapsed , err := Test ()
44
44
assert .NoError (t , err )
45
45
// 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 )
47
48
}
48
49
49
50
func TestGetCache (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments