[Test] allow tests to reuse a singel index across tests
This commit speeds up aggregations tests dramatically since they all rely on the same index structure. Here we can safe a large amout of time to not recreate the index for each small test.
This commit is contained in:
parent
5bf8b79587
commit
a6a12f97a2
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.indices.settings.put.UpdateSettingsRespons
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
|
@ -34,7 +33,7 @@ import static org.hamcrest.Matchers.is;
|
|||
/**
|
||||
* Scoped as test, because the if the test with cluster read only block fails, all other tests fail as well, as this is not cleaned up properly
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST)
|
||||
public class BlockClusterStatsTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.elasticsearch.common.unit.TimeValue;
|
|||
import org.elasticsearch.plugins.AbstractPlugin;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -50,7 +49,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope = Scope.TEST, numNodes = 0)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numNodes = 0)
|
||||
public class ClusterServiceTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.discovery.zen.elect.ElectMasterService;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -39,7 +38,7 @@ import static org.elasticsearch.client.Requests.clusterHealthRequest;
|
|||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
@ClusterScope(scope = Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
public class MinimumMasterNodesTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.discovery.Discovery;
|
|||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -40,7 +39,7 @@ import static org.hamcrest.Matchers.greaterThan;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
public class NoMasterNodeTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.client.Requests;
|
|||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.client.Requests.createIndexRequest;
|
||||
|
@ -36,7 +35,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
public class SimpleDataNodesTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.discovery.MasterNotDiscoveredException;
|
|||
import org.elasticsearch.index.query.FilterBuilders;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
|
@ -34,7 +33,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope = Scope.TEST, numNodes = 0)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numNodes = 0)
|
||||
public class SpecificMasterNodesTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
protected final ImmutableSettings.Builder settingsBuilder() {
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
|||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
@ -32,7 +31,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
public class UpdateSettingsValidationTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.common.settings.ImmutableSettings;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -45,7 +44,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
public class AwarenessAllocationTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(AwarenessAllocationTests.class);
|
||||
|
|
|
@ -40,7 +40,6 @@ import org.elasticsearch.env.NodeEnvironment;
|
|||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -51,7 +50,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ClusterScope(scope = Scope.TEST, numNodes = 0)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numNodes = 0)
|
||||
public class ClusterRerouteTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(ClusterRerouteTests.class);
|
||||
|
|
|
@ -29,13 +29,12 @@ import org.elasticsearch.common.logging.Loggers;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
public class FilteringAllocationTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(FilteringAllocationTests.class);
|
||||
|
|
|
@ -27,12 +27,11 @@ import org.elasticsearch.common.settings.ImmutableSettings;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.instanceOf;
|
||||
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
public class ShardsAllocatorModuleTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
|||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.*;
|
||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import static org.elasticsearch.test.ElasticsearchIntegrationTest.Scope.TEST;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.common.Priority;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
@ -33,7 +32,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ClusterScope(scope=Scope.SUITE, numNodes=2)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.SUITE, numNodes=2)
|
||||
public class ClusterSearchShardsTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -49,4 +49,4 @@ public class ZenUnicastDiscoveryTests extends ElasticsearchIntegrationTest {
|
|||
state = client().admin().cluster().prepareState().execute().actionGet().getState();
|
||||
assertThat(state.nodes().size(), equalTo(2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,9 +35,9 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.gateway.Gateway;
|
||||
import org.elasticsearch.test.*;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.elasticsearch.test.TestCluster;
|
||||
import org.elasticsearch.test.TestCluster.RestartCallback;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -49,7 +49,7 @@ import static org.hamcrest.Matchers.nullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
@Slow
|
||||
public class LocalGatewayIndexStateTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.client.Client;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.elasticsearch.test.TestCluster.RestartCallback;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -45,7 +44,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(numNodes=0, scope=Scope.TEST)
|
||||
@ClusterScope(numNodes=0, scope= ElasticsearchIntegrationTest.Scope.TEST)
|
||||
public class QuorumLocalGatewayTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.index.query.FilterBuilders;
|
|||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.elasticsearch.test.TestCluster.RestartCallback;
|
||||
import org.elasticsearch.test.store.MockDirectoryHelper;
|
||||
import org.junit.Test;
|
||||
|
@ -49,7 +48,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(numNodes = 0, scope = Scope.TEST)
|
||||
@ClusterScope(numNodes = 0, scope = ElasticsearchIntegrationTest.Scope.TEST)
|
||||
@Slow
|
||||
public class SimpleRecoveryLocalGatewayTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.common.unit.TimeValue;
|
|||
import org.elasticsearch.gateway.GatewayService;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
@ -38,7 +37,7 @@ import static org.hamcrest.Matchers.hasItem;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope = Scope.TEST, numNodes = 0)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numNodes = 0)
|
||||
public class RecoverAfterNodesTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private final static TimeValue BLOCK_WAIT_TIMEOUT = TimeValue.timeValueSeconds(1);
|
||||
|
|
|
@ -23,10 +23,8 @@ import org.elasticsearch.action.search.SearchRequest;
|
|||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.common.bytes.BytesArray;
|
||||
import org.elasticsearch.common.bytes.BytesReference;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.hamcrest.ElasticsearchAssertions;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.discovery.Discovery;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.elasticsearch.test.TestCluster;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -53,7 +52,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope = Scope.TEST, numNodes = 0)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numNodes = 0)
|
||||
public class IndexLifecycleActionTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Slow
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.indices.analysis.HunspellService;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
@ -35,7 +34,7 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
public class HunspellServiceTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.index.query.FilterBuilders;
|
|||
import org.elasticsearch.search.sort.SortOrder;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.filteredQuery;
|
||||
|
@ -38,7 +37,7 @@ import static org.hamcrest.Matchers.*;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ClusterScope(scope=Scope.SUITE, numNodes=1)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.SUITE, numNodes=1)
|
||||
public class CacheTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,7 +22,6 @@ package org.elasticsearch.indices.fielddata.breaker;
|
|||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.monitor.jvm.JvmInfo;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
|
||||
package org.elasticsearch.indices.fielddata.breaker;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.annotations.Repeat;
|
||||
import org.apache.lucene.index.AtomicReader;
|
||||
import org.apache.lucene.index.DirectoryReader;
|
||||
import org.elasticsearch.ElasticsearchException;
|
||||
|
@ -30,7 +29,6 @@ import org.elasticsearch.action.admin.indices.refresh.RefreshResponse;
|
|||
import org.elasticsearch.action.search.SearchPhaseExecutionException;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
import org.elasticsearch.client.Requests;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.index.shard.service.IndexShard;
|
|||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
@ -39,7 +38,7 @@ import static org.hamcrest.Matchers.nullValue;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=1)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=1)
|
||||
public class IndicesLeaksTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.apache.lucene.util.LuceneTestCase;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
|
|
|
@ -29,7 +29,8 @@ import org.junit.Test;
|
|||
import java.io.IOException;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
package org.elasticsearch.indices.recovery;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.LifecycleScope;
|
||||
|
||||
import org.elasticsearch.action.admin.cluster.repositories.put.PutRepositoryResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.create.CreateSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.cluster.snapshots.restore.RestoreSnapshotResponse;
|
||||
import org.elasticsearch.action.admin.indices.recovery.RecoveryResponse;
|
||||
|
@ -33,7 +31,6 @@ import org.elasticsearch.index.shard.ShardId;
|
|||
import org.elasticsearch.snapshots.SnapshotState;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -28,14 +28,13 @@ import org.elasticsearch.common.settings.ImmutableSettings;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=2)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=2)
|
||||
public class CloseIndexDisableCloseAllTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.common.io.stream.BytesStreamInput;
|
|||
import org.elasticsearch.common.io.stream.BytesStreamOutput;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -43,7 +42,7 @@ import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilde
|
|||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
@ClusterScope(scope = Scope.SUITE, numNodes = 2)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE, numNodes = 2)
|
||||
public class SimpleIndexStatsTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.env.NodeEnvironment;
|
|||
import org.elasticsearch.index.shard.ShardId;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.elasticsearch.test.TestCluster;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -40,7 +39,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
public class IndicesStoreTests extends ElasticsearchIntegrationTest {
|
||||
private static final Settings SETTINGS = settingsBuilder().put("gateway.type", "local").build();
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.common.settings.ImmutableSettings;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -37,7 +36,7 @@ import java.util.Set;
|
|||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=1)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=1)
|
||||
public class IndexTemplateFileLoadingTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -46,9 +46,7 @@ import java.util.List;
|
|||
import java.util.Set;
|
||||
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertThrows;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.index.query.QueryBuilders;
|
|||
import org.elasticsearch.search.warmer.IndexWarmersMetaData;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.elasticsearch.test.TestCluster.RestartCallback;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
|
@ -39,7 +38,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ClusterScope(numNodes=0, scope=Scope.TEST)
|
||||
@ClusterScope(numNodes=0, scope= ElasticsearchIntegrationTest.Scope.TEST)
|
||||
public class LocalGatewayIndicesWarmerTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private final ESLogger logger = Loggers.getLogger(LocalGatewayIndicesWarmerTests.class);
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.elasticsearch.nodesinfo.plugin.dummy1.TestPlugin;
|
|||
import org.elasticsearch.nodesinfo.plugin.dummy2.TestNoVersionPlugin;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -54,7 +53,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=0)
|
||||
public class SimpleNodesInfoTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
static final class Fields {
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -42,7 +41,7 @@ import static org.hamcrest.Matchers.*;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ClusterScope(scope = Scope.TEST)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST)
|
||||
public class TTLPercolatorTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private static final long PURGE_INTERVAL = 200;
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.elasticsearch.rest.helper.HttpClient;
|
|||
import org.elasticsearch.rest.helper.HttpClientResponse;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.elasticsearch.test.junit.annotations.Network;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
|
@ -51,7 +50,7 @@ import static org.hamcrest.CoreMatchers.is;
|
|||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
|
||||
@ClusterScope(scope = Scope.TEST, numNodes = 0, transportClientRatio = 0.0)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numNodes = 0, transportClientRatio = 0.0)
|
||||
public class PluginManagerTests extends ElasticsearchIntegrationTest {
|
||||
private static final Settings SETTINGS = ImmutableSettings.settingsBuilder()
|
||||
.put("discovery.zen.ping.multicast.enabled", false)
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.rest.helper.HttpClient;
|
|||
import org.elasticsearch.rest.helper.HttpClientResponse;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -38,7 +37,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
* Test a rest action that sets special response headers
|
||||
*/
|
||||
@ClusterScope(scope = Scope.SUITE, numNodes = 1)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE, numNodes = 1)
|
||||
public class ResponseHeaderPluginTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.rest.helper.HttpClient;
|
|||
import org.elasticsearch.rest.helper.HttpClientResponse;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
@ -38,7 +37,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
* We want to test site plugins
|
||||
*/
|
||||
@ClusterScope(scope = Scope.SUITE, numNodes = 1)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE, numNodes = 1)
|
||||
public class SitePluginTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.common.settings.ImmutableSettings;
|
|||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
@ -45,7 +44,7 @@ import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
|||
|
||||
// NB: the tests uses System Properties to pass the information from different plugins (loaded in separate CLs) to the test.
|
||||
// hence the use of try/finally blocks to clean these up after the test has been executed as otherwise the test framework will trigger a failure
|
||||
@ClusterScope(scope = Scope.TEST, numNodes = 0)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numNodes = 0)
|
||||
public class IsolatedPluginTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private static final Settings SETTINGS;
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.common.Priority;
|
|||
import org.elasticsearch.common.collect.MapBuilder;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -36,7 +35,7 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitC
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope = Scope.TEST, numNodes = 0, transportClientRatio = 0.0)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numNodes = 0, transportClientRatio = 0.0)
|
||||
public class FullRollingRestartTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
protected void assertTimeout(ClusterHealthRequestBuilder requestBuilder) {
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.recovery;
|
|||
|
||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
||||
import com.carrotsearch.hppc.procedures.IntProcedure;
|
||||
import com.google.common.base.Predicate;
|
||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.bulk.BulkItemResponse;
|
||||
|
@ -37,7 +38,6 @@ import org.elasticsearch.search.SearchHit;
|
|||
import org.elasticsearch.search.SearchHits;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
@ -51,8 +51,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
|
||||
/**
|
||||
*/
|
||||
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=0)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.TEST, numNodes = 0)
|
||||
public class RelocationTests extends ElasticsearchIntegrationTest {
|
||||
private final TimeValue ACCEPTABLE_RELOCATION_TIME = new TimeValue(5, TimeUnit.MINUTES);
|
||||
|
||||
|
@ -138,7 +137,7 @@ public class RelocationTests extends ElasticsearchIntegrationTest {
|
|||
final AtomicBoolean stop = new AtomicBoolean(false);
|
||||
Thread[] writers = new Thread[numberOfWriters];
|
||||
final CountDownLatch stopLatch = new CountDownLatch(writers.length);
|
||||
|
||||
final CountDownLatch startLatch = new CountDownLatch(1);
|
||||
logger.info("--> starting {} indexing threads", writers.length);
|
||||
for (int i = 0; i < writers.length; i++) {
|
||||
final Client perThreadClient = client();
|
||||
|
@ -147,6 +146,7 @@ public class RelocationTests extends ElasticsearchIntegrationTest {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
startLatch.await();
|
||||
logger.info("**** starting indexing thread {}", indexerId);
|
||||
while (!stop.get()) {
|
||||
if (batch) {
|
||||
|
@ -187,13 +187,17 @@ public class RelocationTests extends ElasticsearchIntegrationTest {
|
|||
};
|
||||
writers[i].start();
|
||||
}
|
||||
|
||||
logger.info("--> waiting for 2000 docs to be indexed ...");
|
||||
while (client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount() < 2000) {
|
||||
Thread.sleep(100);
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
}
|
||||
logger.info("--> 2000 docs indexed");
|
||||
startLatch.countDown();
|
||||
final int numDocs = scaledRandomIntBetween(200, 2500);
|
||||
logger.info("--> waiting for {} docs to be indexed ...", numDocs);
|
||||
awaitBusy(new Predicate<Object>() {
|
||||
@Override
|
||||
public boolean apply(Object input) {
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
return client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount() >= numDocs;
|
||||
}
|
||||
});
|
||||
logger.info("--> {} docs indexed", numDocs);
|
||||
|
||||
logger.info("--> starting relocations...");
|
||||
for (int i = 0; i < numberOfRelocations; i++) {
|
||||
|
@ -297,7 +301,7 @@ public class RelocationTests extends ElasticsearchIntegrationTest {
|
|||
final AtomicBoolean stop = new AtomicBoolean(false);
|
||||
Thread[] writers = new Thread[numberOfWriters];
|
||||
final CountDownLatch stopLatch = new CountDownLatch(writers.length);
|
||||
|
||||
final CountDownLatch startLatch = new CountDownLatch(1);
|
||||
logger.info("--> starting {} indexing threads", writers.length);
|
||||
for (int i = 0; i < writers.length; i++) {
|
||||
final Client perThreadClient = client();
|
||||
|
@ -307,6 +311,7 @@ public class RelocationTests extends ElasticsearchIntegrationTest {
|
|||
public void run() {
|
||||
|
||||
try {
|
||||
startLatch.await();
|
||||
logger.info("**** starting indexing thread {}", indexerId);
|
||||
while (!stop.get()) {
|
||||
if (batch) {
|
||||
|
@ -348,12 +353,17 @@ public class RelocationTests extends ElasticsearchIntegrationTest {
|
|||
writers[i].start();
|
||||
}
|
||||
|
||||
logger.info("--> waiting for 2000 docs to be indexed ...");
|
||||
while (client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount() < 2000) {
|
||||
Thread.sleep(100);
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
}
|
||||
logger.info("--> 2000 docs indexed");
|
||||
startLatch.countDown();
|
||||
final int numDocs = scaledRandomIntBetween(200, 2500);
|
||||
logger.info("--> waiting for {} docs to be indexed ...", numDocs);
|
||||
awaitBusy(new Predicate<Object>() {
|
||||
@Override
|
||||
public boolean apply(Object input) {
|
||||
client().admin().indices().prepareRefresh().execute().actionGet();
|
||||
return client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount() >= numDocs;
|
||||
}
|
||||
});
|
||||
logger.info("--> {} docs indexed", numDocs);
|
||||
|
||||
logger.info("--> starting relocations...");
|
||||
for (int i = 0; i < numberOfRelocations; i++) {
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.plugins.AbstractPlugin;
|
|||
import org.elasticsearch.search.SearchHit;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
@ -35,7 +34,7 @@ import java.util.concurrent.ExecutionException;
|
|||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
@ClusterScope(scope = Scope.SUITE, numNodes = 3)
|
||||
@ClusterScope(scope = ElasticsearchIntegrationTest.Scope.SUITE, numNodes = 3)
|
||||
public class ScriptFieldTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package org.elasticsearch.search.aggregations;
|
||||
|
||||
import org.elasticsearch.action.search.SearchPhaseExecutionException;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
|
|
@ -20,8 +20,9 @@
|
|||
package org.elasticsearch.search.aggregations;
|
||||
|
||||
import com.carrotsearch.hppc.IntOpenHashSet;
|
||||
import org.elasticsearch.action.bulk.BulkRequestBuilder;
|
||||
import org.elasticsearch.action.bulk.BulkResponse;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.lucene.util.LuceneTestCase.Slow;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.action.support.IndicesOptions;
|
||||
|
@ -36,8 +37,11 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
|||
import org.elasticsearch.search.aggregations.bucket.terms.TermsAggregatorFactory;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
@ -46,6 +50,7 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
* Additional tests that aim at testing more complex aggregation trees on larger random datasets, so that things like
|
||||
* the growth of dynamic arrays is tested.
|
||||
*/
|
||||
@Slow
|
||||
public class RandomTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
// Make sure that unordered, reversed, disjoint and/or overlapping ranges are supported
|
||||
|
@ -141,9 +146,8 @@ public class RandomTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
// test long/double/string terms aggs with high number of buckets that require array growth
|
||||
public void testDuelTerms() throws Exception {
|
||||
// These high numbers of docs and terms are important to trigger page recycling
|
||||
final int numDocs = scaledRandomIntBetween(10000, 20000);
|
||||
final int maxNumTerms = randomIntBetween(10, 100000);
|
||||
final int maxNumTerms = randomIntBetween(10, 50000);
|
||||
|
||||
final IntOpenHashSet valuesSet = new IntOpenHashSet();
|
||||
immutableCluster().wipeIndices("idx");
|
||||
|
@ -162,6 +166,8 @@ public class RandomTests extends ElasticsearchIntegrationTest {
|
|||
.endObject()
|
||||
.endObject()
|
||||
.endObject()).execute().actionGet();
|
||||
|
||||
List<IndexRequestBuilder> indexingRequests = Lists.newArrayList();
|
||||
for (int i = 0; i < numDocs; ++i) {
|
||||
final int[] values = new int[randomInt(4)];
|
||||
for (int j = 0; j < values.length; ++j) {
|
||||
|
@ -184,8 +190,14 @@ public class RandomTests extends ElasticsearchIntegrationTest {
|
|||
source = source.value(Integer.toString(values[j]));
|
||||
}
|
||||
source = source.endArray().endObject();
|
||||
client().prepareIndex("idx", "type").setSource(source).execute().actionGet();
|
||||
indexingRequests.add(client().prepareIndex("idx", "type").setSource(source));
|
||||
if (indexingRequests.size() == 5000) {
|
||||
indexRandom(false, indexingRequests);
|
||||
indexingRequests.clear();
|
||||
}
|
||||
}
|
||||
indexRandom(true, indexingRequests);
|
||||
|
||||
assertNoFailures(client().admin().indices().prepareRefresh("idx").setIndicesOptions(IndicesOptions.lenient()).execute().get());
|
||||
|
||||
SearchResponse resp = client().prepareSearch("idx")
|
||||
|
@ -193,7 +205,8 @@ public class RandomTests extends ElasticsearchIntegrationTest {
|
|||
.addAggregation(terms("double").field("double_values").size(maxNumTerms).subAggregation(max("max").field("num")))
|
||||
.addAggregation(terms("string_map").field("string_values").executionHint(TermsAggregatorFactory.ExecutionMode.MAP.toString()).size(maxNumTerms).subAggregation(stats("stats").field("num")))
|
||||
.addAggregation(terms("string_ordinals").field("string_values").executionHint(TermsAggregatorFactory.ExecutionMode.ORDINALS.toString()).size(maxNumTerms).subAggregation(extendedStats("stats").field("num"))).execute().actionGet();
|
||||
assertEquals(0, resp.getFailedShards());
|
||||
assertAllSuccessful(resp);
|
||||
assertEquals(numDocs, resp.getHits().getTotalHits());
|
||||
|
||||
final Terms longTerms = resp.getAggregations().get("long");
|
||||
final Terms doubleTerms = resp.getAggregations().get("double");
|
||||
|
@ -269,23 +282,19 @@ public class RandomTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
final int numDocs = scaledRandomIntBetween(25000, 50000);
|
||||
logger.info("Indexing [" + numDocs +"] docs");
|
||||
int t = 0;
|
||||
for (int i = 0; i < numDocs; ) {
|
||||
BulkRequestBuilder request = client().prepareBulk();
|
||||
final int bulkSize = Math.min(numDocs - i, 100);
|
||||
client().prepareIndex("idx", "type").setSource("double_value", randomDouble()).execute().actionGet();
|
||||
for (int j = 0; j < bulkSize; ++j) {
|
||||
++t;
|
||||
request.add(client().prepareIndex("idx", "type", Integer.toString(i++)).setSource("double_value", randomDouble()));
|
||||
List<IndexRequestBuilder> indexingRequests = Lists.newArrayList();
|
||||
for (int i = 0; i < numDocs; ++i) {
|
||||
indexingRequests.add(client().prepareIndex("idx", "type", Integer.toString(i)).setSource("double_value", randomDouble()));
|
||||
if (indexingRequests.size() == 5000) {
|
||||
indexRandom(false, indexingRequests);
|
||||
indexingRequests.clear();
|
||||
}
|
||||
BulkResponse response = request.execute().actionGet();
|
||||
assertFalse(response.buildFailureMessage(), response.hasFailures());
|
||||
}
|
||||
assertEquals(numDocs, t);
|
||||
assertNoFailures(client().admin().indices().prepareRefresh("idx").execute().get());
|
||||
indexRandom(true, indexingRequests);
|
||||
|
||||
SearchResponse response = client().prepareSearch("idx").addAggregation(terms("terms").field("double_value").subAggregation(percentiles("pcts").field("double_value"))).execute().actionGet();
|
||||
assertNoFailures(response);
|
||||
assertAllSuccessful(response);
|
||||
assertEquals(numDocs, response.getHits().getTotalHits());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -35,11 +35,12 @@ import org.hamcrest.Matchers;
|
|||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.junit.Before;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -54,6 +55,7 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private DateTime date(int month, int day) {
|
||||
|
@ -86,21 +88,35 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
.endObject());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
createIndex("idx_unmapped");
|
||||
// TODO: would be nice to have more random data here
|
||||
indexRandom(true,
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i*2)
|
||||
.endObject()));
|
||||
}
|
||||
builders.addAll(Arrays.asList(
|
||||
indexDoc(1, 2, 1), // date: Jan 2, dates: Jan 2, Feb 3
|
||||
indexDoc(2, 2, 2), // date: Feb 2, dates: Feb 2, Mar 3
|
||||
indexDoc(2, 15, 3), // date: Feb 15, dates: Feb 15, Mar 16
|
||||
indexDoc(3, 2, 4), // date: Mar 2, dates: Mar 2, Apr 3
|
||||
indexDoc(3, 15, 5), // date: Mar 15, dates: Mar 15, Apr 16
|
||||
indexDoc(3, 23, 6)); // date: Mar 23, dates: Mar 23, Apr 24
|
||||
indexDoc(3, 23, 6))); // date: Mar 23, dates: Mar 23, Apr 24
|
||||
indexRandom(true, builders);
|
||||
ensureSearchable();
|
||||
}
|
||||
|
||||
@After
|
||||
public void afterEachTest() throws IOException {
|
||||
cluster().wipeIndices("idx2");
|
||||
}
|
||||
|
||||
private static DateHistogram.Bucket getBucket(DateHistogram histogram, DateTime key) {
|
||||
return getBucket(histogram, key, DateFieldMapper.Defaults.DATE_TIME_FORMATTER.format());
|
||||
}
|
||||
|
@ -982,16 +998,6 @@ public class DateHistogramTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field("value").interval(1l).minDocCount(0).subAggregation(dateHistogram("date_histo").interval(1)))
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
|||
import org.hamcrest.Matchers;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.DateTimeZone;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -40,6 +39,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -49,6 +49,7 @@ import static org.hamcrest.core.IsNull.nullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class DateRangeTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private static IndexRequestBuilder indexDoc(int month, int day, int value) throws Exception {
|
||||
|
@ -64,10 +65,9 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
return new DateTime(2012, month, day, 0, 0, DateTimeZone.UTC);
|
||||
}
|
||||
|
||||
int numDocs;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
private static int numDocs;
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
createIndex("idx_unmapped");
|
||||
|
||||
|
@ -86,7 +86,13 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
for (int i = docs.size(); i < numDocs; ++i) {
|
||||
docs.add(indexDoc(randomIntBetween(6, 10), randomIntBetween(1, 20), randomInt(100)));
|
||||
}
|
||||
|
||||
assertAcked(prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer"));
|
||||
for (int i = 0; i < 2; i++) {
|
||||
docs.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, docs);
|
||||
ensureSearchable();
|
||||
}
|
||||
|
@ -1010,16 +1016,6 @@ public class DateRangeTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field("value").interval(1l).minDocCount(0).subAggregation(dateRange("date_range").addRange("0-1", 0, 1)))
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
|||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.cache.recycler.MockBigArrays;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -45,6 +44,7 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
|||
import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -53,38 +53,42 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private static final int NUM_DOCS = 5; // TODO: randomize the size?
|
||||
private static final String SINGLE_VALUED_FIELD_NAME = "d_value";
|
||||
private static final String MULTI_VALUED_FIELD_NAME = "d_values";
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
|
||||
IndexRequestBuilder[] lowcardBuilders = new IndexRequestBuilder[NUM_DOCS];
|
||||
for (int i = 0; i < lowcardBuilders.length; i++) {
|
||||
lowcardBuilders[i] = client().prepareIndex("idx", "type").setSource(jsonBuilder()
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < NUM_DOCS; i++) {
|
||||
builders.add(client().prepareIndex("idx", "type").setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, (double) i)
|
||||
.field("num_tag", i < lowcardBuilders.length/2 + 1 ? 1 : 0) // used to test order by single-bucket sub agg
|
||||
.field("num_tag", i < NUM_DOCS/2 + 1 ? 1 : 0) // used to test order by single-bucket sub agg
|
||||
.startArray(MULTI_VALUED_FIELD_NAME).value((double) i).value(i + 1d).endArray()
|
||||
.endObject());
|
||||
.endObject()));
|
||||
|
||||
}
|
||||
indexRandom(randomBoolean(), lowcardBuilders);
|
||||
IndexRequestBuilder[] highCardBuilders = new IndexRequestBuilder[100]; // TODO: randomize the size?
|
||||
for (int i = 0; i < highCardBuilders.length; i++) {
|
||||
highCardBuilders[i] = client().prepareIndex("idx", "high_card_type").setSource(jsonBuilder()
|
||||
for (int i = 0; i < 100; i++) {
|
||||
builders.add(client().prepareIndex("idx", "high_card_type").setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, (double) i)
|
||||
.startArray(MULTI_VALUED_FIELD_NAME).value((double)i).value(i + 1d).endArray()
|
||||
.endObject());
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, highCardBuilders);
|
||||
|
||||
createIndex("idx_unmapped");
|
||||
assertAcked(prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer"));
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders);
|
||||
ensureSearchable();
|
||||
}
|
||||
|
||||
|
@ -610,16 +614,6 @@ public class DoubleTermsTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1l).minDocCount(0)
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
|||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -45,12 +44,13 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class FilterTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
int numDocs, numTag1Docs;
|
||||
static int numDocs, numTag1Docs;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
createIndex("idx2");
|
||||
numDocs = randomIntBetween(5, 20);
|
||||
|
@ -71,8 +71,14 @@ public class FilterTests extends ElasticsearchIntegrationTest {
|
|||
.field("name", "name" + i)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
ensureGreen();
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders);
|
||||
ensureSearchable();
|
||||
}
|
||||
|
||||
|
@ -137,16 +143,6 @@ public class FilterTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field("value").interval(1l).minDocCount(0)
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.search.aggregations.bucket.range.geodistance.GeoDistanc
|
|||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -47,6 +46,7 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class GeoDistanceTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private IndexRequestBuilder indexCity(String idx, String name, String... latLons) throws Exception {
|
||||
|
@ -60,8 +60,7 @@ public class GeoDistanceTests extends ElasticsearchIntegrationTest {
|
|||
return client().prepareIndex(idx, "type").setSource(source);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
prepareCreate("idx")
|
||||
.addMapping("type", "location", "type=geo_point", "city", "type=string,index=not_analyzed")
|
||||
.execute().actionGet();
|
||||
|
@ -104,7 +103,16 @@ public class GeoDistanceTests extends ElasticsearchIntegrationTest {
|
|||
}
|
||||
}
|
||||
indexRandom(true, cities);
|
||||
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer", "location", "type=geo_point").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i * 2)
|
||||
.field("location", "52.0945, 5.116")
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
ensureSearchable();
|
||||
}
|
||||
|
||||
|
@ -348,17 +356,6 @@ public class GeoDistanceTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer", "location", "type=geo_point").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i * 2)
|
||||
.field("location", "52.0945, 5.116")
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field("value").interval(1l).minDocCount(0)
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.search.aggregations.AggregationBuilders;
|
|||
import org.elasticsearch.search.aggregations.bucket.filter.Filter;
|
||||
import org.elasticsearch.search.aggregations.bucket.geogrid.GeoHashGrid;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -43,6 +42,7 @@ import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcke
|
|||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
|
||||
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class GeoHashGridTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private IndexRequestBuilder indexCity(String name, String latLon) throws Exception {
|
||||
|
@ -55,14 +55,14 @@ public class GeoHashGridTests extends ElasticsearchIntegrationTest {
|
|||
}
|
||||
|
||||
|
||||
ObjectIntMap<String> expectedDocCountsForGeoHash = null;
|
||||
int highestPrecisionGeohash = 12;
|
||||
int numRandomPoints = 100;
|
||||
static ObjectIntMap<String> expectedDocCountsForGeoHash = null;
|
||||
static int highestPrecisionGeohash = 12;
|
||||
static int numRandomPoints = 100;
|
||||
|
||||
String smallestGeoHash = null;
|
||||
static String smallestGeoHash = null;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
assertAcked(prepareCreate("idx")
|
||||
.addMapping("type", "location", "type=geo_point", "city", "type=string,index=not_analyzed"));
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.index.query.QueryBuilders;
|
|||
import org.elasticsearch.search.aggregations.bucket.global.Global;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.Stats;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -42,12 +41,13 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class GlobalTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
int numDocs;
|
||||
static int numDocs;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
createIndex("idx2");
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
|
|
|
@ -29,7 +29,6 @@ import org.elasticsearch.search.aggregations.metrics.stats.Stats;
|
|||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -47,18 +46,19 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class HistogramTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private static final String SINGLE_VALUED_FIELD_NAME = "l_value";
|
||||
private static final String MULTI_VALUED_FIELD_NAME = "l_values";
|
||||
|
||||
int numDocs;
|
||||
int interval;
|
||||
int numValueBuckets, numValuesBuckets;
|
||||
long[] valueCounts, valuesCounts;
|
||||
static int numDocs;
|
||||
static int interval;
|
||||
static int numValueBuckets, numValuesBuckets;
|
||||
static long[] valueCounts, valuesCounts;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
createIndex("idx_unmapped");
|
||||
|
||||
|
@ -790,6 +790,7 @@ public class HistogramTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
cluster().wipeIndices("empty_bucket_idx");
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.metrics.max.Max;
|
|||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -36,6 +35,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -45,25 +45,39 @@ import static org.hamcrest.core.IsNull.nullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
prepareCreate("idx")
|
||||
.addMapping("type", "ip", "type=ip", "ips", "type=ip")
|
||||
.execute().actionGet();
|
||||
IndexRequestBuilder[] builders = new IndexRequestBuilder[255]; // TODO randomize the size?
|
||||
// TODO randomize the values in the docs?
|
||||
for (int i = 0; i < builders.length; i++) {
|
||||
builders[i] = client().prepareIndex("idx", "type").setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("ip", "10.0.0." + (i))
|
||||
.startArray("ips").value("10.0.0." + i).value("10.0.0." + (i + 1)).endArray()
|
||||
.field("value", (i < 100 ? 1 : i < 200 ? 2 : 3)) // 100 1's, 100 2's, and 55 3's
|
||||
.endObject());
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
{
|
||||
assertAcked(prepareCreate("idx")
|
||||
.addMapping("type", "ip", "type=ip", "ips", "type=ip"));
|
||||
IndexRequestBuilder[] builders = new IndexRequestBuilder[255]; // TODO randomize the size?
|
||||
// TODO randomize the values in the docs?
|
||||
for (int i = 0; i < builders.length; i++) {
|
||||
builders[i] = client().prepareIndex("idx", "type").setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("ip", "10.0.0." + (i))
|
||||
.startArray("ips").value("10.0.0." + i).value("10.0.0." + (i + 1)).endArray()
|
||||
.field("value", (i < 100 ? 1 : i < 200 ? 2 : 3)) // 100 1's, 100 2's, and 55 3's
|
||||
.endObject());
|
||||
}
|
||||
indexRandom(true, builders);
|
||||
createIndex("idx_unmapped");
|
||||
}
|
||||
{
|
||||
assertAcked(prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer", "ip", "type=ip"));
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i * 2)
|
||||
.field("ip", "10.0.0.5")
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
}
|
||||
indexRandom(true, builders);
|
||||
createIndex("idx_unmapped");
|
||||
ensureSearchable();
|
||||
}
|
||||
|
||||
|
@ -819,17 +833,6 @@ public class IPv4RangeTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer", "ip", "type=ip").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i * 2)
|
||||
.field("ip", "10.0.0.5")
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field("value").interval(1l).minDocCount(0)
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
|||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.cache.recycler.MockBigArrays;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -43,6 +42,7 @@ import java.util.List;
|
|||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertSearchResponse;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.is;
|
||||
|
@ -51,14 +51,15 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class LongTermsTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private static final int NUM_DOCS = 5; // TODO randomize the size?
|
||||
private static final String SINGLE_VALUED_FIELD_NAME = "l_value";
|
||||
private static final String MULTI_VALUED_FIELD_NAME = "l_values";
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
IndexRequestBuilder[] lowCardBuilders = new IndexRequestBuilder[NUM_DOCS];
|
||||
for (int i = 0; i < lowCardBuilders.length; i++) {
|
||||
|
@ -77,13 +78,23 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
.field(SINGLE_VALUED_FIELD_NAME, i)
|
||||
.startArray(MULTI_VALUED_FIELD_NAME).value(i).value(i + 1).endArray()
|
||||
.endObject());
|
||||
|
||||
|
||||
}
|
||||
indexRandom(true, highCardBuilders);
|
||||
createIndex("idx_unmapped");
|
||||
|
||||
assertAcked(prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer"));
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, i * 2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
ensureSearchable();
|
||||
}
|
||||
|
||||
|
||||
private String key(Terms.Bucket bucket) {
|
||||
return randomBoolean() ? bucket.getKey() : key(bucket);
|
||||
}
|
||||
|
@ -602,16 +613,6 @@ public class LongTermsTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1l).minDocCount(0)
|
||||
|
|
|
@ -33,10 +33,8 @@ import org.elasticsearch.search.aggregations.bucket.histogram.Histogram;
|
|||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.format.DateTimeFormat;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
|
@ -47,15 +45,15 @@ import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
|||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
|
||||
|
||||
@TestLogging("_root:TRACE")
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class MinDocCountTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private static final QueryBuilder QUERY = QueryBuilders.termQuery("match", true);
|
||||
|
||||
private int cardinality;
|
||||
private static int cardinality;
|
||||
|
||||
@Before
|
||||
public void indexData() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
|
||||
cardinality = randomIntBetween(8, 30);
|
||||
|
|
|
@ -25,7 +25,6 @@ import org.elasticsearch.search.aggregations.bucket.missing.Missing;
|
|||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -42,12 +41,13 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class MissingTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
int numDocs, numDocsMissing, numDocsUnmapped;
|
||||
static int numDocs, numDocsMissing, numDocsUnmapped;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
numDocs = randomIntBetween(5, 20);
|
||||
|
@ -74,8 +74,15 @@ public class MissingTests extends ElasticsearchIntegrationTest {
|
|||
.endObject()));
|
||||
}
|
||||
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
ensureGreen(); // wait until we are ready to serve requests
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i*2)
|
||||
.endObject()));
|
||||
}
|
||||
|
||||
indexRandom(true, builders);
|
||||
ensureSearchable();
|
||||
}
|
||||
|
||||
|
@ -157,7 +164,7 @@ public class MissingTests extends ElasticsearchIntegrationTest {
|
|||
@Test
|
||||
public void withInheritedSubMissing() throws Exception {
|
||||
|
||||
SearchResponse response = client().prepareSearch()
|
||||
SearchResponse response = client().prepareSearch("idx", "unmapped_idx")
|
||||
.addAggregation(missing("top_missing").field("tag")
|
||||
.subAggregation(missing("sub_missing")))
|
||||
.execute().actionGet();
|
||||
|
@ -179,16 +186,6 @@ public class MissingTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field("value").interval(1l).minDocCount(0)
|
||||
|
|
|
@ -29,13 +29,13 @@ import org.elasticsearch.search.aggregations.metrics.MetricsAggregationBuilder;
|
|||
import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
||||
import org.elasticsearch.search.aggregations.metrics.stats.extended.ExtendedStats;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.search.aggregations.AggregationBuilders.*;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class NaNSortingTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private enum SubAggregation {
|
||||
|
@ -93,8 +93,8 @@ public class NaNSortingTests extends ElasticsearchIntegrationTest {
|
|||
public abstract double getValue(Aggregation aggregation);
|
||||
}
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
final int numDocs = randomIntBetween(2, 10);
|
||||
for (int i = 0; i < numDocs; ++i) {
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.search.aggregations.metrics.stats.Stats;
|
|||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.cache.recycler.MockBigArrays;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -49,13 +48,14 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class NestedTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
int numParents;
|
||||
int[] numChildren;
|
||||
static int numParents;
|
||||
static int[] numChildren;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
|
||||
assertAcked(prepareCreate("idx")
|
||||
.addMapping("type", "nested", "type=nested"));
|
||||
|
@ -87,6 +87,21 @@ public class NestedTests extends ElasticsearchIntegrationTest {
|
|||
source = source.endArray().endObject();
|
||||
builders.add(client().prepareIndex("idx", "type", ""+i+1).setSource(source));
|
||||
}
|
||||
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer", "nested", "type=nested").execute().actionGet();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i*2)
|
||||
.startArray("nested")
|
||||
.startObject().field("value", i + 1).endObject()
|
||||
.startObject().field("value", i + 2).endObject()
|
||||
.startObject().field("value", i + 3).endObject()
|
||||
.startObject().field("value", i + 4).endObject()
|
||||
.startObject().field("value", i + 5).endObject()
|
||||
.endArray()
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders);
|
||||
ensureSearchable();
|
||||
}
|
||||
|
@ -224,23 +239,6 @@ public class NestedTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", "value", "type=integer", "nested", "type=nested").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field("value", i*2)
|
||||
.startArray("nested")
|
||||
.startObject().field("value", i + 1).endObject()
|
||||
.startObject().field("value", i + 2).endObject()
|
||||
.startObject().field("value", i + 3).endObject()
|
||||
.startObject().field("value", i + 4).endObject()
|
||||
.startObject().field("value", i + 5).endObject()
|
||||
.endArray()
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field("value").interval(1l).minDocCount(0)
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.search.aggregations.metrics.avg.Avg;
|
|||
import org.elasticsearch.search.aggregations.metrics.sum.Sum;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -44,27 +43,35 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class RangeTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private static final String SINGLE_VALUED_FIELD_NAME = "l_value";
|
||||
private static final String MULTI_VALUED_FIELD_NAME = "l_values";
|
||||
|
||||
int numDocs;
|
||||
static int numDocs;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
numDocs = randomIntBetween(10, 20);
|
||||
IndexRequestBuilder[] builders = new IndexRequestBuilder[numDocs];
|
||||
for (int i = 0; i < builders.length; i++) {
|
||||
builders[i] = client().prepareIndex("idx", "type").setSource(jsonBuilder()
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < numDocs; i++) {
|
||||
builders.add(client().prepareIndex("idx", "type").setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, i+1)
|
||||
.startArray(MULTI_VALUED_FIELD_NAME).value(i+1).value(i+2).endArray()
|
||||
.endObject());
|
||||
.endObject()));
|
||||
}
|
||||
createIndex("idx_unmapped");
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").execute().actionGet();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, i * 2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders);
|
||||
createIndex("idx_unmapped");
|
||||
ensureSearchable();
|
||||
}
|
||||
|
||||
|
@ -943,16 +950,6 @@ public class RangeTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", "" + i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, i * 2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1l).minDocCount(0)
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.elasticsearch.search.aggregations.bucket.range.date.DateRange;
|
|||
import org.elasticsearch.search.aggregations.bucket.range.ipv4.IPv4Range;
|
||||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
|
@ -50,6 +49,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
* compute empty buckets, its {@code reduce()} method must be called. So by adding the date histogram under other buckets,
|
||||
* we can make sure that the reduce is properly propagated by checking that empty buckets were created.
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class ShardReduceTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private IndexRequestBuilder indexDoc(String date, int value) throws Exception {
|
||||
|
@ -68,8 +68,8 @@ public class ShardReduceTests extends ElasticsearchIntegrationTest {
|
|||
.endObject());
|
||||
}
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
assertAcked(prepareCreate("idx")
|
||||
.addMapping("type", "nested", "type=nested", "ip", "type=ip", "location", "type=geo_point"));
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.elasticsearch.search.aggregations.bucket.significant.SignificantTerms
|
|||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTerms.Bucket;
|
||||
import org.elasticsearch.search.aggregations.bucket.significant.SignificantTermsBuilder;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
@ -41,6 +40,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class SignificantTermsTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
@ -55,8 +55,8 @@ public class SignificantTermsTests extends ElasticsearchIntegrationTest {
|
|||
public static final int OTHER_CATEGORY=2;
|
||||
public static final int SNOWBOARDING_CATEGORY=3;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
assertAcked(prepareCreate("test").setSettings(SETTING_NUMBER_OF_SHARDS, 5, SETTING_NUMBER_OF_REPLICAS, 0).addMapping("fact",
|
||||
"_routing", "required=true,path=routing_id", "routing_id", "type=string,index=not_analyzed", "fact_category",
|
||||
"type=integer,index=not_analyzed", "description", "type=string,index=analyzed"));
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount;
|
|||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.cache.recycler.MockBigArrays;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -54,6 +53,7 @@ import static org.hamcrest.core.IsNull.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class StringTermsTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
private static final String SINGLE_VALUED_FIELD_NAME = "s_value";
|
||||
|
@ -63,30 +63,36 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
return randomBoolean() ? null : randomFrom(TermsAggregatorFactory.ExecutionMode.values()).toString();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
IndexRequestBuilder[] lowCardBuilders = new IndexRequestBuilder[5]; // TODO randomize the size?
|
||||
for (int i = 0; i < lowCardBuilders.length; i++) {
|
||||
lowCardBuilders[i] = client().prepareIndex("idx", "type").setSource(jsonBuilder()
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 5; i++) {
|
||||
builders.add(client().prepareIndex("idx", "type").setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, "val" + i)
|
||||
.field("i", i)
|
||||
.field("tag", i < lowCardBuilders.length/2 + 1 ? "more" : "less")
|
||||
.field("tag", i < 5/2 + 1 ? "more" : "less")
|
||||
.startArray(MULTI_VALUED_FIELD_NAME).value("val" + i).value("val" + (i + 1)).endArray()
|
||||
.endObject());
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, lowCardBuilders);
|
||||
IndexRequestBuilder[] highCardBuilders = new IndexRequestBuilder[100]; // TODO randomize the size?
|
||||
|
||||
for (int i = 0; i < highCardBuilders.length; i++) {
|
||||
highCardBuilders[i] = client().prepareIndex("idx", "high_card_type").setSource(jsonBuilder()
|
||||
for (int i = 0; i < 100; i++) {
|
||||
builders.add(client().prepareIndex("idx", "high_card_type").setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, "val" + Strings.padStart(i+"", 3, '0'))
|
||||
.startArray(MULTI_VALUED_FIELD_NAME).value("val" + Strings.padStart(i+"", 3, '0')).value("val" + Strings.padStart((i+1)+"", 3, '0')).endArray()
|
||||
.endObject());
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, highCardBuilders);
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").execute().actionGet();
|
||||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders);
|
||||
createIndex("idx_unmapped");
|
||||
ensureSearchable();
|
||||
}
|
||||
|
@ -765,16 +771,6 @@ public class StringTermsTests extends ElasticsearchIntegrationTest {
|
|||
|
||||
@Test
|
||||
public void emptyAggregation() throws Exception {
|
||||
prepareCreate("empty_bucket_idx").addMapping("type", SINGLE_VALUED_FIELD_NAME, "type=integer").execute().actionGet();
|
||||
List<IndexRequestBuilder> builders = new ArrayList<>();
|
||||
for (int i = 0; i < 2; i++) {
|
||||
builders.add(client().prepareIndex("empty_bucket_idx", "type", ""+i).setSource(jsonBuilder()
|
||||
.startObject()
|
||||
.field(SINGLE_VALUED_FIELD_NAME, i*2)
|
||||
.endObject()));
|
||||
}
|
||||
indexRandom(true, builders.toArray(new IndexRequestBuilder[builders.size()]));
|
||||
|
||||
SearchResponse searchResponse = client().prepareSearch("empty_bucket_idx")
|
||||
.setQuery(matchAllQuery())
|
||||
.addAggregation(histogram("histo").field(SINGLE_VALUED_FIELD_NAME).interval(1l).minDocCount(0)
|
||||
|
|
|
@ -20,7 +20,6 @@ package org.elasticsearch.search.aggregations.metrics;
|
|||
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -30,12 +29,13 @@ import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public abstract class AbstractNumericTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
protected long minValue, maxValue, minValues, maxValues;
|
||||
protected static long minValue, maxValue, minValues, maxValues;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
createIndex("idx_unmapped");
|
||||
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
|
||||
import org.elasticsearch.search.aggregations.metrics.cardinality.Cardinality;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
|
@ -37,6 +36,7 @@ import static org.hamcrest.Matchers.equalTo;
|
|||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.core.IsNull.notNullValue;
|
||||
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class CardinalityTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
@ -47,11 +47,11 @@ public class CardinalityTests extends ElasticsearchIntegrationTest {
|
|||
.build();
|
||||
}
|
||||
|
||||
long numDocs;
|
||||
long precisionThreshold;
|
||||
static long numDocs;
|
||||
static long precisionThreshold;
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
|
||||
prepareCreate("idx").addMapping("type",
|
||||
jsonBuilder().startObject().startObject("type").startObject("properties")
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.elasticsearch.search.aggregations.metrics;
|
|||
import org.elasticsearch.action.search.SearchResponse;
|
||||
import org.elasticsearch.search.aggregations.metrics.valuecount.ValueCount;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
|
@ -33,10 +32,11 @@ import static org.hamcrest.Matchers.notNullValue;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ElasticsearchIntegrationTest.SuiteScopeTest
|
||||
public class ValueCountTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Before
|
||||
public void init() throws Exception {
|
||||
@Override
|
||||
public void setupSuiteScopeCluster() throws Exception {
|
||||
createIndex("idx");
|
||||
createIndex("idx_unmapped");
|
||||
for (int i = 0; i < 10; i++) {
|
||||
|
|
|
@ -59,8 +59,8 @@ public class HyperLogLogPlusPlusTests extends ElasticsearchTestCase {
|
|||
@Test
|
||||
public void accuracy() {
|
||||
final long bucket = randomInt(20);
|
||||
final int numValues = randomIntBetween(1, 1000000);
|
||||
final int maxValue = randomIntBetween(1, randomBoolean() ? 1000: 1000000);
|
||||
final int numValues = randomIntBetween(1, 100000);
|
||||
final int maxValue = randomIntBetween(1, randomBoolean() ? 1000: 100000);
|
||||
final int p = randomIntBetween(14, MAX_PRECISION);
|
||||
IntOpenHashSet set = new IntOpenHashSet();
|
||||
HyperLogLogPlusPlus e = new HyperLogLogPlusPlus(p, BigArrays.NON_RECYCLING_INSTANCE, 1);
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
package org.elasticsearch.search.basic;
|
||||
|
||||
import com.carrotsearch.randomizedtesting.annotations.Nightly;
|
||||
import com.carrotsearch.randomizedtesting.annotations.Repeat;
|
||||
import org.apache.lucene.util.LuceneTestCase;
|
||||
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
|
||||
import org.elasticsearch.action.index.IndexRequestBuilder;
|
||||
import org.elasticsearch.action.search.SearchPhaseExecutionException;
|
||||
|
@ -29,7 +27,6 @@ import org.elasticsearch.action.search.SearchResponse;
|
|||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.search.SearchHits;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -28,9 +28,7 @@ import org.junit.Test;
|
|||
import java.io.IOException;
|
||||
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.functionScoreQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.simpleQueryString;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.*;
|
||||
import static org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders.fieldValueFactorFunction;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
|
||||
|
||||
|
|
|
@ -25,7 +25,10 @@ import org.elasticsearch.common.geo.ShapeRelation;
|
|||
import org.elasticsearch.common.geo.builders.ShapeBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.index.query.*;
|
||||
import org.elasticsearch.index.query.FilterBuilders;
|
||||
import org.elasticsearch.index.query.GeoShapeFilterBuilder;
|
||||
import org.elasticsearch.index.query.GeoShapeQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
|
|
|
@ -24,7 +24,8 @@ import org.elasticsearch.action.search.SearchType;
|
|||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.elasticsearch.client.Requests.*;
|
||||
import static org.elasticsearch.client.Requests.indexRequest;
|
||||
import static org.elasticsearch.client.Requests.searchRequest;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.jsonBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.termQuery;
|
||||
import static org.elasticsearch.search.builder.SearchSourceBuilder.searchSource;
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.action.search.type.ParsedScrollId;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.elasticsearch.action.search.type.ParsedScrollId;
|
|||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
|
|
@ -41,9 +41,7 @@ import java.util.Set;
|
|||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAllSuccessful;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,6 @@ import org.elasticsearch.search.suggest.context.ContextBuilder;
|
|||
import org.elasticsearch.search.suggest.context.ContextMapping;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.hamcrest.Matchers;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -26,7 +26,6 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -39,7 +38,7 @@ import static org.hamcrest.Matchers.is;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope=Scope.SUITE, numNodes=1)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.SUITE, numNodes=1)
|
||||
public class CustomSuggesterSearchTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.elasticsearch.common.settings.ImmutableSettings;
|
|||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.snapshots.mockstore.MockRepositoryModule;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.junit.annotations.TestLogging;
|
||||
import org.elasticsearch.test.store.MockDirectoryHelper;
|
||||
import org.elasticsearch.threadpool.ThreadPool;
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.elasticsearch.test;
|
|||
import com.carrotsearch.randomizedtesting.RandomizedContext;
|
||||
import com.carrotsearch.randomizedtesting.SeedUtils;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.lucene.util.AbstractRandomizedTest;
|
||||
import org.elasticsearch.ExceptionsHelper;
|
||||
|
@ -47,6 +48,7 @@ import org.elasticsearch.client.Requests;
|
|||
import org.elasticsearch.client.internal.InternalClient;
|
||||
import org.elasticsearch.cluster.ClusterService;
|
||||
import org.elasticsearch.cluster.metadata.MetaData;
|
||||
import org.elasticsearch.common.Nullable;
|
||||
import org.elasticsearch.common.Priority;
|
||||
import org.elasticsearch.common.Strings;
|
||||
import org.elasticsearch.common.collect.Tuple;
|
||||
|
@ -59,10 +61,7 @@ import org.elasticsearch.common.xcontent.XContentBuilder;
|
|||
import org.elasticsearch.discovery.zen.elect.ElectMasterService;
|
||||
import org.elasticsearch.rest.RestStatus;
|
||||
import org.elasticsearch.test.client.RandomizingClient;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.*;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
@ -73,10 +72,12 @@ import java.util.*;
|
|||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_REPLICAS;
|
||||
import static org.elasticsearch.cluster.metadata.IndexMetaData.SETTING_NUMBER_OF_SHARDS;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilder;
|
||||
import static org.elasticsearch.index.query.QueryBuilders.matchAllQuery;
|
||||
import static org.elasticsearch.test.TestCluster.clusterName;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
|
@ -151,6 +152,12 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
* Threshold at which indexing switches from frequently async to frequently bulk.
|
||||
*/
|
||||
private static final int FREQUENT_BULK_THRESHOLD = 300;
|
||||
|
||||
/**
|
||||
* Threshold at which bulk indexing will always be used.
|
||||
*/
|
||||
private static final int ALWAYS_BULK_THRESHOLD = 3000;
|
||||
|
||||
/**
|
||||
* Maximum number of async operations that indexRandom will kick off at one time.
|
||||
*/
|
||||
|
@ -171,9 +178,12 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
|
||||
private static final Map<Class<?>, ImmutableTestCluster> clusters = new IdentityHashMap<>();
|
||||
|
||||
private static ElasticsearchIntegrationTest INSTANCE = null; // see @SuiteScope
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
initializeGlobalCluster();
|
||||
initializeSuiteScope();
|
||||
}
|
||||
|
||||
private static void initializeGlobalCluster() {
|
||||
|
@ -204,8 +214,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
}
|
||||
}
|
||||
|
||||
@Before
|
||||
public final void before() throws IOException {
|
||||
protected final void beforeInternal() throws IOException {
|
||||
assert Thread.getDefaultUncaughtExceptionHandler() instanceof ElasticsearchUncaughtExceptionHandler;
|
||||
try {
|
||||
final Scope currentClusterScope = getCurrentClusterScope();
|
||||
|
@ -256,8 +265,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
}
|
||||
}
|
||||
|
||||
@After
|
||||
public final void after() throws IOException {
|
||||
protected final void afterInternal() throws IOException {
|
||||
boolean success = false;
|
||||
try {
|
||||
logger.info("[{}#{}]: cleaning up after test", getTestClass().getSimpleName(), getTestName());
|
||||
|
@ -502,6 +510,75 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
return actionGet.getStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits until at least a give number of document is visible for searchers
|
||||
*
|
||||
* @param numDocs number of documents to wait for.
|
||||
* @return the actual number of docs seen.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public long waitForDocs(final long numDocs) throws InterruptedException {
|
||||
return waitForDocs(numDocs, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits until at least a give number of document is visible for searchers
|
||||
*
|
||||
* @param numDocs number of documents to wait for
|
||||
* @param indexer a {@link org.elasticsearch.test.BackgroundIndexer}. If supplied it will be first checked for documents indexed.
|
||||
* This saves on unneeded searches.
|
||||
* @return the actual number of docs seen.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public long waitForDocs(final long numDocs, final @Nullable BackgroundIndexer indexer) throws InterruptedException {
|
||||
// indexing threads can wait for up to ~1m before retrying when they first try to index into a shard which is not STARTED.
|
||||
return waitForDocs(numDocs, 90, TimeUnit.SECONDS, indexer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits until at least a give number of document is visible for searchers
|
||||
*
|
||||
* @param numDocs number of documents to wait for
|
||||
* @param maxWaitTime if not progress have been made during this time, fail the test
|
||||
* @param maxWaitTimeUnit the unit in which maxWaitTime is specified
|
||||
* @param indexer a {@link org.elasticsearch.test.BackgroundIndexer}. If supplied it will be first checked for documents indexed.
|
||||
* This saves on unneeded searches.
|
||||
* @return the actual number of docs seen.
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public long waitForDocs(final long numDocs, int maxWaitTime, TimeUnit maxWaitTimeUnit, final @Nullable BackgroundIndexer indexer)
|
||||
throws InterruptedException {
|
||||
final long[] lastKnownCount = {-1};
|
||||
long lastStartCount = -1;
|
||||
Predicate<Object> testDocs = new Predicate<Object>() {
|
||||
public boolean apply(Object o) {
|
||||
lastKnownCount[0] = indexer.totalIndexedDocs();
|
||||
if (lastKnownCount[0] > numDocs) {
|
||||
long count = client().prepareCount().setQuery(matchAllQuery()).execute().actionGet().getCount();
|
||||
if (count == lastKnownCount[0]) {
|
||||
// no progress - try to refresh for the next time
|
||||
client().admin().indices().prepareRefresh().get();
|
||||
}
|
||||
lastKnownCount[0] = count;
|
||||
logger.debug("[{}] docs visible for search. waiting for [{}]", lastKnownCount[0], numDocs);
|
||||
} else {
|
||||
logger.debug("[{}] docs indexed. waiting for [{}]", lastKnownCount[0], numDocs);
|
||||
}
|
||||
return lastKnownCount[0] > numDocs;
|
||||
}
|
||||
};
|
||||
|
||||
while (!awaitBusy(testDocs, maxWaitTime, maxWaitTimeUnit)) {
|
||||
if (lastStartCount == lastKnownCount[0]) {
|
||||
// we didn't make any progress
|
||||
fail("failed to reach " + numDocs + "docs");
|
||||
}
|
||||
lastStartCount = lastKnownCount[0];
|
||||
}
|
||||
return lastKnownCount[0];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the cluster's minimum master node and make sure the response is acknowledge.
|
||||
* Note: this doesn't guaranty the new settings is in effect, just that it has been received bu all nodes.
|
||||
|
@ -681,7 +758,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
final CopyOnWriteArrayList<Tuple<IndexRequestBuilder, Throwable>> errors = new CopyOnWriteArrayList<>();
|
||||
List<CountDownLatch> inFlightAsyncOperations = new ArrayList<>();
|
||||
// If you are indexing just a few documents then frequently do it one at a time. If many then frequently in bulk.
|
||||
if (builders.size() < FREQUENT_BULK_THRESHOLD ? frequently() : rarely()) {
|
||||
if (builders.size() < FREQUENT_BULK_THRESHOLD ? frequently() : builders.size() < ALWAYS_BULK_THRESHOLD ? rarely() : false) {
|
||||
if (frequently()) {
|
||||
logger.info("Index [{}] docs async: [{}] bulk: [{}]", builders.size(), true, false);
|
||||
for (IndexRequestBuilder indexRequestBuilder : builders) {
|
||||
|
@ -706,7 +783,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
assertThat(actionGet.hasFailures() ? actionGet.buildFailureMessage() : "", actionGet.hasFailures(), equalTo(false));
|
||||
}
|
||||
}
|
||||
for (CountDownLatch operation: inFlightAsyncOperations) {
|
||||
for (CountDownLatch operation : inFlightAsyncOperations) {
|
||||
operation.await();
|
||||
}
|
||||
final List<Throwable> actualErrors = new ArrayList<>();
|
||||
|
@ -730,7 +807,7 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
}
|
||||
|
||||
/**
|
||||
* Maybe refresh, optimize, or flush then always make sure there aren't too many in flight async operations.
|
||||
* Maybe refresh, optimize, or flush then always make sure there aren't too many in flight async operations.
|
||||
*/
|
||||
private void postIndexAsyncActions(String[] indices, List<CountDownLatch> inFlightAsyncOperations) throws InterruptedException {
|
||||
if (rarely()) {
|
||||
|
@ -751,6 +828,65 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The scope of a test cluster used together with
|
||||
* {@link org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope} annotations on {@link org.elasticsearch.test.ElasticsearchIntegrationTest} subclasses.
|
||||
*/
|
||||
public static enum Scope {
|
||||
/**
|
||||
* A globally shared cluster. This cluster doesn't allow modification of transient or persistent
|
||||
* cluster settings.
|
||||
*/
|
||||
GLOBAL,
|
||||
/**
|
||||
* A cluster shared across all method in a single test suite
|
||||
*/
|
||||
SUITE,
|
||||
/**
|
||||
* A test exclusive test cluster
|
||||
*/
|
||||
TEST
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a cluster scope for a {@link org.elasticsearch.test.ElasticsearchIntegrationTest} subclass.
|
||||
* By default if no {@link ClusterScope} annotation is present {@link org.elasticsearch.test.ElasticsearchIntegrationTest.Scope#GLOBAL} is used
|
||||
* together with randomly chosen settings like number of nodes etc.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface ClusterScope {
|
||||
/**
|
||||
* Returns the scope. {@link org.elasticsearch.test.ElasticsearchIntegrationTest.Scope#GLOBAL} is default.
|
||||
*/
|
||||
Scope scope() default Scope.GLOBAL;
|
||||
|
||||
/**
|
||||
* Returns the number of nodes in the cluster. Default is <tt>-1</tt> which means
|
||||
* a random number of nodes is used, where the minimum and maximum number of nodes
|
||||
* are either the specified ones or the default ones if not specified.
|
||||
*/
|
||||
int numNodes() default -1;
|
||||
|
||||
/**
|
||||
* Returns the minimum number of nodes in the cluster. Default is {@link org.elasticsearch.test.TestCluster#DEFAULT_MIN_NUM_NODES}.
|
||||
* Ignored when {@link ClusterScope#numNodes()} is set.
|
||||
*/
|
||||
int minNumNodes() default TestCluster.DEFAULT_MIN_NUM_NODES;
|
||||
|
||||
/**
|
||||
* Returns the maximum number of nodes in the cluster. Default is {@link org.elasticsearch.test.TestCluster#DEFAULT_MAX_NUM_NODES}.
|
||||
* Ignored when {@link ClusterScope#numNodes()} is set.
|
||||
*/
|
||||
int maxNumNodes() default TestCluster.DEFAULT_MAX_NUM_NODES;
|
||||
|
||||
/**
|
||||
* Returns the transport client ratio. By default this returns <code>-1</code> which means a random
|
||||
* ratio in the interval <code>[0..1]</code> is used.
|
||||
*/
|
||||
double transportClientRatio() default -1;
|
||||
}
|
||||
|
||||
private class LatchedActionListener<Response> implements ActionListener<Response> {
|
||||
private final CountDownLatch latch;
|
||||
|
||||
|
@ -803,27 +939,6 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
assertThat(clearResponse.isSucceeded(), equalTo(true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The scope of a test cluster used together with
|
||||
* {@link ClusterScope} annotations on {@link ElasticsearchIntegrationTest} subclasses.
|
||||
*/
|
||||
public static enum Scope {
|
||||
/**
|
||||
* A globally shared cluster. This cluster doesn't allow modification of transient or persistent
|
||||
* cluster settings.
|
||||
*/
|
||||
GLOBAL,
|
||||
/**
|
||||
* A cluster shared across all method in a single test suite
|
||||
*/
|
||||
SUITE,
|
||||
/**
|
||||
* A test exclusive test cluster
|
||||
*/
|
||||
TEST
|
||||
}
|
||||
|
||||
private ClusterScope getAnnotation(Class<?> clazz) {
|
||||
if (clazz == Object.class || clazz == ElasticsearchIntegrationTest.class) {
|
||||
return null;
|
||||
|
@ -897,45 +1012,6 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
return new TestCluster(currentClusterSeed, minNumNodes, maxNumNodes, clusterName(scope.name(), ElasticsearchTestCase.CHILD_VM_ID, currentClusterSeed), nodeSettingsSource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines a cluster scope for a {@link ElasticsearchIntegrationTest} subclass.
|
||||
* By default if no {@link ClusterScope} annotation is present {@link Scope#GLOBAL} is used
|
||||
* together with randomly chosen settings like number of nodes etc.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
public @interface ClusterScope {
|
||||
/**
|
||||
* Returns the scope. {@link Scope#GLOBAL} is default.
|
||||
*/
|
||||
Scope scope() default Scope.GLOBAL;
|
||||
|
||||
/**
|
||||
* Returns the number of nodes in the cluster. Default is <tt>-1</tt> which means
|
||||
* a random number of nodes is used, where the minimum and maximum number of nodes
|
||||
* are either the specified ones or the default ones if not specified.
|
||||
*/
|
||||
int numNodes() default -1;
|
||||
|
||||
/**
|
||||
* Returns the minimum number of nodes in the cluster. Default is {@link TestCluster#DEFAULT_MIN_NUM_NODES}.
|
||||
* Ignored when {@link ClusterScope#numNodes()} is set.
|
||||
*/
|
||||
int minNumNodes() default TestCluster.DEFAULT_MIN_NUM_NODES;
|
||||
|
||||
/**
|
||||
* Returns the maximum number of nodes in the cluster. Default is {@link TestCluster#DEFAULT_MAX_NUM_NODES}.
|
||||
* Ignored when {@link ClusterScope#numNodes()} is set.
|
||||
*/
|
||||
int maxNumNodes() default TestCluster.DEFAULT_MAX_NUM_NODES;
|
||||
|
||||
/**
|
||||
* Returns the transport client ratio. By default this returns <code>-1</code> which means a random
|
||||
* ratio in the interval <code>[0..1]</code> is used.
|
||||
*/
|
||||
double transportClientRatio() default -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the client ratio configured via
|
||||
*/
|
||||
|
@ -1002,4 +1078,90 @@ public abstract class ElasticsearchIntegrationTest extends ElasticsearchTestCase
|
|||
this.totalNumShards = numPrimaries * dataCopies;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean runTestScopeLifecycle() {
|
||||
return INSTANCE == null;
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
public final void before() throws IOException {
|
||||
if (runTestScopeLifecycle()) {
|
||||
beforeInternal();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@After
|
||||
public final void after() throws IOException {
|
||||
if (runTestScopeLifecycle()) {
|
||||
afterInternal();
|
||||
}
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() throws IOException {
|
||||
if (!runTestScopeLifecycle()) {
|
||||
try {
|
||||
INSTANCE.afterInternal();
|
||||
} finally {
|
||||
INSTANCE = null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private final static void initializeSuiteScope() throws Exception {
|
||||
Class<?> targetClass = getContext().getTargetClass();
|
||||
assert INSTANCE == null;
|
||||
if (isSuiteScope(targetClass)) {
|
||||
// note we need to do this this way to make sure this is reproducible
|
||||
INSTANCE = (ElasticsearchIntegrationTest) targetClass.newInstance();
|
||||
boolean success = false;
|
||||
try {
|
||||
INSTANCE.beforeInternal();
|
||||
INSTANCE.setupSuiteScopeCluster();
|
||||
success = true;
|
||||
} finally {
|
||||
if (!success) {
|
||||
afterClass();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
INSTANCE = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is executed iff the test is annotated with {@link SuiteScopeTest}
|
||||
* before the first test of this class is executed.
|
||||
*
|
||||
* @see SuiteScopeTest
|
||||
*/
|
||||
protected void setupSuiteScopeCluster() throws Exception {}
|
||||
|
||||
private static boolean isSuiteScope(Class<?> clazz) {
|
||||
if (clazz == Object.class || clazz == ElasticsearchIntegrationTest.class) {
|
||||
return false;
|
||||
}
|
||||
SuiteScopeTest annotation = clazz.getAnnotation(SuiteScopeTest.class);
|
||||
if (annotation != null) {
|
||||
return true;
|
||||
}
|
||||
return isSuiteScope(clazz.getSuperclass());
|
||||
}
|
||||
|
||||
/**
|
||||
* If a test is annotated with {@link org.elasticsearch.test.ElasticsearchIntegrationTest.SuiteScopeTest}
|
||||
* the checks and modifications that are applied to the used test cluster are only done after all tests
|
||||
* of this class are executed. This also has the side-effect of a suite level setup method {@link #setupSuiteScopeCluster()}
|
||||
* that is executed in a separate test instance. Variables that need to be accessible across test instances must be static.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE})
|
||||
@Ignore
|
||||
public @interface SuiteScopeTest {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.elasticsearch.common.xcontent.XContentParser;
|
|||
import org.elasticsearch.common.xcontent.json.JsonXContent;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.elasticsearch.threadpool.ThreadPool.Names;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -43,7 +42,7 @@ import static org.hamcrest.Matchers.*;
|
|||
|
||||
/**
|
||||
*/
|
||||
@ClusterScope(scope=Scope.TEST, numNodes=2)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.TEST, numNodes=2)
|
||||
public class SimpleThreadPoolTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,8 +39,6 @@ import org.junit.AfterClass;
|
|||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.common.settings.Settings;
|
|||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -36,7 +35,7 @@ import static org.elasticsearch.common.settings.ImmutableSettings.settingsBuilde
|
|||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
@ClusterScope(scope=Scope.SUITE, numNodes = 1)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.SUITE, numNodes = 1)
|
||||
public class SimpleTTLTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
static private final long PURGE_INTERVAL = 200;
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.elasticsearch.script.ExecutableScript;
|
|||
import org.elasticsearch.script.NativeScriptFactory;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.ClusterScope;
|
||||
import org.elasticsearch.test.ElasticsearchIntegrationTest.Scope;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -38,7 +37,7 @@ import static org.hamcrest.Matchers.is;
|
|||
/**
|
||||
*
|
||||
*/
|
||||
@ClusterScope(scope=Scope.SUITE, numNodes=1)
|
||||
@ClusterScope(scope= ElasticsearchIntegrationTest.Scope.SUITE, numNodes=1)
|
||||
public class UpdateByNativeScriptTests extends ElasticsearchIntegrationTest {
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue