yifan-c commented on code in PR #138: URL: https://github.com/apache/cassandra-analytics/pull/138#discussion_r2326392658
########## cassandra-five-zero-bridge/src/test/java/org/apache/cassandra/spark/reader/SSTableCacheTests.java: ########## @@ -191,4 +201,35 @@ public void testCache() } }); } + + @Test + void testNoLeakDetectedError() throws Exception + { + Partitioner partitioner = Partitioner.Murmur3Partitioner; + try (TemporaryDirectory directory = new TemporaryDirectory()) + { + // Write an SSTable + TestSchema schema = TestSchema.basic(BRIDGE); + schema.writeSSTable(directory, BRIDGE, partitioner, + writer -> IntStream.range(0, 10).forEach(index -> writer.write(index, 0, index))); + SSTable sstable = TestSSTable.firstIn(directory.path()); + TableMetadata metadata = new SchemaBuilder(schema.createStatement, + schema.keyspace, + new ReplicationFactor(ReplicationFactor.ReplicationStrategy.SimpleStrategy, + ImmutableMap.of("replication_factor", 1)), + partitioner).tableMetaData(); + + SummaryDbUtils.Summary summary = SSTableCache.INSTANCE.keysFromSummary(metadata, sstable); + assertThat(summary).isNotNull(); + assertThat(SSTableCache.INSTANCE.containsSummary(sstable)).isTrue(); + SSTableCache.INSTANCE.invalidate(sstable); + summary = null; + assertThat(SSTableCache.INSTANCE.containsSummary(sstable)).isFalse(); + // trigger GC and wait a bit before asserting LEAK DETECTED is not logged. + System.gc(); + Thread.sleep(1000); Review Comment: Changed to `Uninterruptibles`. I was under the impression that we removed `guava` from the repo. But looks like we still have them as test dependency. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org For additional commands, e-mail: commits-h...@cassandra.apache.org