Reduce number of threads in o.e.c.c.CacheTests

This commit reduces the randomized number of threads in the cache tests
to reduce the amount of time that the tests take to execute.
This commit is contained in:
Jason Tedor 2015-12-22 16:54:44 -05:00
parent f9a601c7da
commit 4c9a9b4b2d
1 changed files with 4 additions and 4 deletions

View File

@ -492,7 +492,7 @@ public class CacheTests extends ESTestCase {
} }
public void testComputeIfAbsentCallsOnce() throws InterruptedException { public void testComputeIfAbsentCallsOnce() throws InterruptedException {
int numberOfThreads = randomIntBetween(2, 200); int numberOfThreads = randomIntBetween(2, 32);
final Cache<Integer, String> cache = CacheBuilder.<Integer, String>builder().build(); final Cache<Integer, String> cache = CacheBuilder.<Integer, String>builder().build();
List<Thread> threads = new ArrayList<>(); List<Thread> threads = new ArrayList<>();
AtomicReferenceArray flags = new AtomicReferenceArray(numberOfEntries); AtomicReferenceArray flags = new AtomicReferenceArray(numberOfEntries);
@ -558,7 +558,7 @@ public class CacheTests extends ESTestCase {
} }
} }
int numberOfThreads = randomIntBetween(2, 256); int numberOfThreads = randomIntBetween(2, 32);
final Cache<Key, Integer> cache = CacheBuilder.<Key, Integer>builder().build(); final Cache<Key, Integer> cache = CacheBuilder.<Key, Integer>builder().build();
CountDownLatch latch = new CountDownLatch(1 + numberOfThreads); CountDownLatch latch = new CountDownLatch(1 + numberOfThreads);
CountDownLatch deadlockLatch = new CountDownLatch(numberOfThreads); CountDownLatch deadlockLatch = new CountDownLatch(numberOfThreads);
@ -626,7 +626,7 @@ public class CacheTests extends ESTestCase {
} }
public void testCachePollution() throws InterruptedException { public void testCachePollution() throws InterruptedException {
int numberOfThreads = randomIntBetween(2, 200); int numberOfThreads = randomIntBetween(2, 32);
final Cache<Integer, String> cache = CacheBuilder.<Integer, String>builder().build(); final Cache<Integer, String> cache = CacheBuilder.<Integer, String>builder().build();
CountDownLatch latch = new CountDownLatch(1 + numberOfThreads); CountDownLatch latch = new CountDownLatch(1 + numberOfThreads);
List<Thread> threads = new ArrayList<>(); List<Thread> threads = new ArrayList<>();
@ -676,7 +676,7 @@ public class CacheTests extends ESTestCase {
// test that the cache is not corrupted under lots of concurrent modifications, even hitting the same key // test that the cache is not corrupted under lots of concurrent modifications, even hitting the same key
// here be dragons: this test did catch one subtle bug during development; do not remove lightly // here be dragons: this test did catch one subtle bug during development; do not remove lightly
public void testTorture() throws InterruptedException { public void testTorture() throws InterruptedException {
int numberOfThreads = randomIntBetween(2, 200); int numberOfThreads = randomIntBetween(2, 32);
final Cache<Integer, String> cache = final Cache<Integer, String> cache =
CacheBuilder.<Integer, String>builder() CacheBuilder.<Integer, String>builder()
.setMaximumWeight(1000) .setMaximumWeight(1000)