LUCENE-6096: Relax assertion about memory usage since memory usage depends on the JVM impl and settings.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1644594 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Adrien Grand 2014-12-11 11:00:08 +00:00
parent e9366323e8
commit 16337aba86
1 changed files with 6 additions and 1 deletions

View File

@ -57,7 +57,12 @@ public class TestLRUFilterCache extends LuceneTestCase {
}; };
public void testFilterRamBytesUsed() { public void testFilterRamBytesUsed() {
assertEquals(LRUFilterCache.FILTER_DEFAULT_RAM_BYTES_USED, RamUsageTester.sizeOf(new QueryWrapperFilter(new TermQuery(new Term("some_field", "some_term"))))); final Filter simpleFilter = new QueryWrapperFilter(new TermQuery(new Term("some_field", "some_term")));
final long actualRamBytesUsed = RamUsageTester.sizeOf(simpleFilter);
final long ramBytesUsed = LRUFilterCache.FILTER_DEFAULT_RAM_BYTES_USED;
// we cannot assert exactly that the constant is correct since actual
// memory usage depends on JVM implementations and settings (eg. UseCompressedOops)
assertEquals(actualRamBytesUsed, ramBytesUsed, actualRamBytesUsed / 2);
} }
public void testConcurrency() throws Throwable { public void testConcurrency() throws Throwable {