Skip to content

Commit e839d4e

Browse files
nikagraclaude
andcommitted
test: await the prepared-cache removal event
Guava lowers the cache size before it calls the removal listener, so the size wait alone left the removed-query-id assertion racing the event. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 5048379 commit e839d4e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎integration-tests/src/test/java/com/datastax/oss/driver/core/cql/PreparedStatementCachingIT.java‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ private void invalidationTestInner(
276276
await()
277277
.atMost(30, TimeUnit.SECONDS)
278278
.untilAsserted(() -> assertThat(getPreparedCacheSize(session)).isEqualTo(1));
279+
// Guava lowers the size before it calls the removal listener
280+
await()
281+
.atMost(30, TimeUnit.SECONDS)
282+
.untilAsserted(() -> assertThat(removedQueryIds.get()).contains(queryId2));
279283

280284
assertThat(session.prepare(preparedStmtQueryType1)).isSameAs(statement1);
281285
assertThat(getPreparedCacheSize(session)).isEqualTo(1);
@@ -284,7 +288,6 @@ private void invalidationTestInner(
284288
assertThat(getPreparedCacheSize(session)).isEqualTo(2);
285289

286290
assertThat(changedTypes.keySet()).isEqualTo(expectedChangedTypes);
287-
assertThat(removedQueryIds.get()).isNotEmpty().get().isEqualTo(queryId2);
288291

289292
// check no errors were seen in callback (and report those as fail msgs)
290293
// if something is broken these may still succeed due to timing

0 commit comments

Comments
 (0)