Skip to content

Commit 6d9e2c4

Browse files
authored
Improve stability of FixedSizeCacheTest identity/weak tests (#9362)
by eliminating the chance identity hash might collide even after 3 rehashes the easiest way to do this is to bump the size of the cache used in testing note this is only necessary because we want to keep both keys in the cache to test the 'visit' method - otherwise we'd need to relax that assertion
1 parent ee43e5f commit 6d9e2c4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal-api/src/test/groovy/datadog/trace/api/cache/FixedSizeCacheTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class FixedSizeCacheTest extends DDSpecification {
112112

113113
def "identity cache should store and retrieve values"() {
114114
setup:
115-
def fsCache = DDCaches.newFixedSizeIdentityCache(15)
115+
def fsCache = DDCaches.newFixedSizeIdentityCache(256)
116116
def creationCount = new AtomicInteger(0)
117117
def tvc = new TVC(creationCount)
118118
fsCache.computeIfAbsent(id1, tvc)
@@ -140,7 +140,7 @@ class FixedSizeCacheTest extends DDSpecification {
140140

141141
def "weak key cache should store and retrieve values"() {
142142
setup:
143-
def fsCache = DDCaches.newFixedSizeWeakKeyCache(15)
143+
def fsCache = DDCaches.newFixedSizeWeakKeyCache(256)
144144
def creationCount = new AtomicInteger(0)
145145
def tvc = new TVC(creationCount)
146146
fsCache.computeIfAbsent(id1, tvc)

0 commit comments

Comments
 (0)