Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions core/src/test/java/org/apache/gravitino/cache/TestCacheConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void testPolicyAndTagCacheWeigher() throws InterruptedException {
.build();
cache.put(
EntityCacheRelationKey.of(
NameIdentifier.of(new String[] {"metalake1", "catalog1", "schema1", filesetName}),
NameIdentifier.of("metalake1", "catalog1", "schema1", filesetName),
Entity.EntityType.FILESET),
List.of(fileset));
}
Expand Down Expand Up @@ -201,11 +201,15 @@ void testPolicyAndTagCacheWeigher() throws InterruptedException {
"Expected significant eviction due to weight limit (max=5000). Found filesets=%d, tags=%d (total=%d/20)",
remainingFilesets, remainingTags, remainingFilesets + remainingTags));

Assertions.assertTrue(
remainingFilesets > remainingTags,
String.format(
"Expected filesets (weight=200, freq=5) to be prioritized over tags (weight=500, freq=1). Found filesets=%d, tags=%d",
remainingFilesets, remainingTags));
// Comment the following case due to the occasional test failure in CI environment. The weight
// mechanism in Caffeine is probabilistic, so in some rare cases tags may not be fully evicted.
// So we will comment out this strict assertion for now.
// Assertions.assertTrue(
// remainingFilesets > remainingTags,
// String.format(
// "Expected filesets (weight=200, freq=5) to be prioritized over tags (weight=500,
// freq=1). Found filesets=%d, tags=%d",
// remainingFilesets, remainingTags));
}

@Test
Expand Down