From 16337aba86616cad46ebd52081e138635f634bda Mon Sep 17 00:00:00 2001 From: Adrien Grand Date: Thu, 11 Dec 2014 11:00:08 +0000 Subject: [PATCH] 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 --- .../test/org/apache/lucene/search/TestLRUFilterCache.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/test/org/apache/lucene/search/TestLRUFilterCache.java b/lucene/core/src/test/org/apache/lucene/search/TestLRUFilterCache.java index 3f3b351d419..38e8413910a 100644 --- a/lucene/core/src/test/org/apache/lucene/search/TestLRUFilterCache.java +++ b/lucene/core/src/test/org/apache/lucene/search/TestLRUFilterCache.java @@ -57,7 +57,12 @@ public class TestLRUFilterCache extends LuceneTestCase { }; 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 {