|
|
@@ -41,7 +41,7 @@ public class JavaScriptScriptMultiThreadedTests extends ESTestCase {
|
|
|
final Object compiled = se.compile(null, "x + y", Collections.emptyMap());
|
|
|
final AtomicBoolean failed = new AtomicBoolean();
|
|
|
|
|
|
- Thread[] threads = new Thread[50];
|
|
|
+ Thread[] threads = new Thread[between(3, 12)];
|
|
|
final CountDownLatch latch = new CountDownLatch(threads.length);
|
|
|
final CyclicBarrier barrier = new CyclicBarrier(threads.length + 1);
|
|
|
for (int i = 0; i < threads.length; i++) {
|
|
|
@@ -57,7 +57,7 @@ public class JavaScriptScriptMultiThreadedTests extends ESTestCase {
|
|
|
vars.put("x", x);
|
|
|
vars.put("y", y);
|
|
|
ExecutableScript script = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testExecutableNoRuntimeParams", "js", compiled), vars);
|
|
|
- for (int i = 0; i < 100000; i++) {
|
|
|
+ for (int i = 0; i < between(100, 1000); i++) {
|
|
|
long result = ((Number) script.run()).longValue();
|
|
|
assertThat(result, equalTo(addition));
|
|
|
}
|
|
|
@@ -83,7 +83,7 @@ public class JavaScriptScriptMultiThreadedTests extends ESTestCase {
|
|
|
final Object compiled = se.compile(null, "x + y", Collections.emptyMap());
|
|
|
final AtomicBoolean failed = new AtomicBoolean();
|
|
|
|
|
|
- Thread[] threads = new Thread[50];
|
|
|
+ Thread[] threads = new Thread[between(3, 12)];
|
|
|
final CountDownLatch latch = new CountDownLatch(threads.length);
|
|
|
final CyclicBarrier barrier = new CyclicBarrier(threads.length + 1);
|
|
|
for (int i = 0; i < threads.length; i++) {
|
|
|
@@ -96,7 +96,7 @@ public class JavaScriptScriptMultiThreadedTests extends ESTestCase {
|
|
|
Map<String, Object> vars = new HashMap<String, Object>();
|
|
|
vars.put("x", x);
|
|
|
ExecutableScript script = se.executable(new CompiledScript(ScriptService.ScriptType.INLINE, "testExecutableNoRuntimeParams", "js", compiled), vars);
|
|
|
- for (int i = 0; i < 100000; i++) {
|
|
|
+ for (int i = 0; i < between(100, 1000); i++) {
|
|
|
long y = Randomness.get().nextInt();
|
|
|
long addition = x + y;
|
|
|
script.setNextVar("y", y);
|
|
|
@@ -125,7 +125,7 @@ public class JavaScriptScriptMultiThreadedTests extends ESTestCase {
|
|
|
final Object compiled = se.compile(null, "x + y", Collections.emptyMap());
|
|
|
final AtomicBoolean failed = new AtomicBoolean();
|
|
|
|
|
|
- Thread[] threads = new Thread[50];
|
|
|
+ Thread[] threads = new Thread[between(3, 12)];
|
|
|
final CountDownLatch latch = new CountDownLatch(threads.length);
|
|
|
final CyclicBarrier barrier = new CyclicBarrier(threads.length + 1);
|
|
|
for (int i = 0; i < threads.length; i++) {
|
|
|
@@ -135,7 +135,7 @@ public class JavaScriptScriptMultiThreadedTests extends ESTestCase {
|
|
|
try {
|
|
|
barrier.await();
|
|
|
Map<String, Object> runtimeVars = new HashMap<String, Object>();
|
|
|
- for (int i = 0; i < 100000; i++) {
|
|
|
+ for (int i = 0; i < between(100, 1000); i++) {
|
|
|
long x = Randomness.get().nextInt();
|
|
|
long y = Randomness.get().nextInt();
|
|
|
long addition = x + y;
|