浏览代码

[TEST] randomize byte size and thread count in breaker tests

Lee Hinman 11 年之前
父节点
当前提交
f9f8459c79
共有 1 个文件被更改,包括 6 次插入6 次删除
  1. 6 6
      src/test/java/org/elasticsearch/common/breaker/MemoryCircuitBreakerTests.java

+ 6 - 6
src/test/java/org/elasticsearch/common/breaker/MemoryCircuitBreakerTests.java

@@ -41,8 +41,8 @@ public class MemoryCircuitBreakerTests extends ElasticsearchTestCase {
 
 
     @Test
     @Test
     public void testThreadedUpdatesToBreaker() throws Exception {
     public void testThreadedUpdatesToBreaker() throws Exception {
-        final int NUM_THREADS = 5;
-        final int BYTES_PER_THREAD = 1000;
+        final int NUM_THREADS = scaledRandomIntBetween(3, 15);
+        final int BYTES_PER_THREAD = scaledRandomIntBetween(500, 4500);
         final Thread[] threads = new Thread[NUM_THREADS];
         final Thread[] threads = new Thread[NUM_THREADS];
         final AtomicBoolean tripped = new AtomicBoolean(false);
         final AtomicBoolean tripped = new AtomicBoolean(false);
         final AtomicReference<Throwable> lastException = new AtomicReference<>(null);
         final AtomicReference<Throwable> lastException = new AtomicReference<>(null);
@@ -83,8 +83,8 @@ public class MemoryCircuitBreakerTests extends ElasticsearchTestCase {
 
 
     @Test
     @Test
     public void testThreadedUpdatesToChildBreaker() throws Exception {
     public void testThreadedUpdatesToChildBreaker() throws Exception {
-        final int NUM_THREADS = 5;
-        final int BYTES_PER_THREAD = 1000;
+        final int NUM_THREADS = scaledRandomIntBetween(3, 15);
+        final int BYTES_PER_THREAD = scaledRandomIntBetween(500, 4500);
         final Thread[] threads = new Thread[NUM_THREADS];
         final Thread[] threads = new Thread[NUM_THREADS];
         final AtomicBoolean tripped = new AtomicBoolean(false);
         final AtomicBoolean tripped = new AtomicBoolean(false);
         final AtomicReference<Throwable> lastException = new AtomicReference<>(null);
         final AtomicReference<Throwable> lastException = new AtomicReference<>(null);
@@ -141,8 +141,8 @@ public class MemoryCircuitBreakerTests extends ElasticsearchTestCase {
 
 
     @Test
     @Test
     public void testThreadedUpdatesToChildBreakerWithParentLimit() throws Exception {
     public void testThreadedUpdatesToChildBreakerWithParentLimit() throws Exception {
-        final int NUM_THREADS = 5;
-        final int BYTES_PER_THREAD = 1000;
+        final int NUM_THREADS = scaledRandomIntBetween(3, 15);
+        final int BYTES_PER_THREAD = scaledRandomIntBetween(500, 4500);
         final Thread[] threads = new Thread[NUM_THREADS];
         final Thread[] threads = new Thread[NUM_THREADS];
         final AtomicInteger tripped = new AtomicInteger(0);
         final AtomicInteger tripped = new AtomicInteger(0);
         final AtomicReference<Throwable> lastException = new AtomicReference<>(null);
         final AtomicReference<Throwable> lastException = new AtomicReference<>(null);