SOLR-2410: add test that normally hits phase3 cleaning w/ PQ

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1079827 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2011-03-09 15:12:16 +00:00
parent 907d4c708f
commit bcc16311a1
1 changed files with 12 additions and 0 deletions

View File

@ -254,6 +254,18 @@ public class TestFastLRUCache extends LuceneTestCase {
cache.destroy();
}
// enough randomness to exercise all of the different cache purging phases
public void testRandom() {
int sz = random.nextInt(100)+5;
int lowWaterMark = random.nextInt(sz-3)+1;
int keyrange = random.nextInt(sz*3)+1;
ConcurrentLRUCache<Integer, String> cache = new ConcurrentLRUCache<Integer, String>(sz, lowWaterMark);
for (int i=0; i<10000; i++) {
cache.put(random.nextInt(keyrange), "");
cache.get(random.nextInt(keyrange));
}
}
void doPerfTest(int iter, int cacheSize, int maxKey) {
long start = System.currentTimeMillis();