mirror of
https://github.com/lukaszraczylo/traefikoidc.git
synced 2026-10-17 04:37:48 +00:00
Weekend fun with further optimisations.
This commit is contained in:
+11
-4
@@ -23,7 +23,7 @@ func TestMemoryLeakFixes(t *testing.T) {
|
||||
initialGoroutines := runtime.NumGoroutine()
|
||||
|
||||
// Create multiple caches
|
||||
caches := make([]*Cache, 10)
|
||||
caches := make([]CacheInterface, 10)
|
||||
for i := 0; i < 10; i++ {
|
||||
caches[i] = NewCache()
|
||||
caches[i].Set("key", "value", time.Hour)
|
||||
@@ -232,9 +232,16 @@ func TestJWKCacheNoDoubleStorage(t *testing.T) {
|
||||
}
|
||||
|
||||
// Verify no double storage by checking cache internals
|
||||
// The cache should only use internalCache, not the jwks field
|
||||
if cache.internalCache == nil {
|
||||
t.Error("Internal cache should be initialized")
|
||||
// The cache should only use internal cache structure
|
||||
// We can verify this by checking if we can retrieve keys
|
||||
ctx2 := context.Background()
|
||||
httpClient2 := &http.Client{Timeout: 10 * time.Second}
|
||||
retrievedJWKS, err := cache.GetJWKS(ctx2, "provider1", httpClient2)
|
||||
if err == nil && retrievedJWKS != nil {
|
||||
// Successfully retrieved from cache
|
||||
if len(retrievedJWKS.Keys) != 1 {
|
||||
t.Error("Expected JWKS with one key from cache")
|
||||
}
|
||||
}
|
||||
|
||||
// Run cleanup
|
||||
|
||||
Reference in New Issue
Block a user