MCPcopy Create free account
hub / github.com/UiPath/uipathcli / TestGetDoesNotReturnExpiredData

Function TestGetDoesNotReturnExpiredData

cache/file_cache_test.go:42–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

40}
41
42func TestGetDoesNotReturnExpiredData(t *testing.T) {
43 cache := NewFileCache()
44
45 key := randomKey()
46 cache.Set(key, "my-value", time.Now().UTC().Add(-time.Second))
47 value, expiry := cache.Get(key)
48
49 if value != "" {
50 t.Errorf("Should not return any data from cache, but got: %v", value)
51 }
52 zero := time.Time{}
53 if expiry != zero {
54 t.Errorf("Should not return expiry value, but got: %v", expiry)
55 }
56}
57
58func randomKey() string {
59 randBytes := make([]byte, 32)

Callers

nothing calls this directly

Calls 5

SetMethod · 0.95
GetMethod · 0.95
NewFileCacheFunction · 0.85
randomKeyFunction · 0.85
AddMethod · 0.80

Tested by

no test coverage detected