Skip to content

Commit

Permalink
iter
Browse files Browse the repository at this point in the history
  • Loading branch information
javanna committed Jan 20, 2025
1 parent ff43d5a commit fca5510
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

package org.elasticsearch.search;

import com.carrotsearch.randomizedtesting.annotations.Repeat;

import org.apache.lucene.util.ThreadInterruptedException;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.search.SearchRequestBuilder;
Expand Down Expand Up @@ -54,7 +56,7 @@ protected Settings nodeSettings(int nodeOrdinal, Settings otherSettings) {
@Override
protected void setupSuiteScopeCluster() throws Exception {
super.setupSuiteScopeCluster();
indexRandom(true, "test", randomIntBetween(5, 30));
indexRandom(true, "test", randomIntBetween(20, 50));
}

@Override
Expand All @@ -63,6 +65,7 @@ public void tearDown() throws Exception {
scriptExecutions.set(0);
}

@Repeat(iterations = 100)
public void testTopHitsTimeout() {
SearchRequestBuilder searchRequestBuilder = prepareSearch("test").setTimeout(new TimeValue(100, TimeUnit.MILLISECONDS))
.setQuery(scriptQuery(new Script(ScriptType.INLINE, "mockscript", SCRIPT_NAME, Collections.emptyMap())));
Expand All @@ -77,8 +80,8 @@ public void testTopHitsTimeout() {
});
}

@Repeat(iterations = 100)
public void testAggsTimeout() {
indexRandom(true, "test", randomIntBetween(5, 30));
SearchRequestBuilder searchRequestBuilder = prepareSearch("test").setTimeout(new TimeValue(100, TimeUnit.MILLISECONDS))
.setSize(0)
.setQuery(scriptQuery(new Script(ScriptType.INLINE, "mockscript", SCRIPT_NAME, Collections.emptyMap())))
Expand Down Expand Up @@ -120,7 +123,7 @@ public Map<String, Function<Map<String, Object>, Object>> pluginScripts() {
// This ensures that one document is always returned before the timeout happens.
// Also, don't sleep any further to avoid slowing down the test excessively.
// A timeout on a specific slice of a single shard is enough.
if (scriptExecutions.incrementAndGet() == 1) {
if (scriptExecutions.getAndIncrement() == 1) {
try {
Thread.sleep(500);
} catch (InterruptedException e) {
Expand Down

0 comments on commit fca5510

Please sign in to comment.