refactor search tests into separate packages
This commit is contained in:
parent
256f1d3611
commit
95dc08fa3b
|
@ -23,13 +23,13 @@ import org.elasticsearch.client.Client;
|
|||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.elasticsearch.common.transport.TransportAddress;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.test.integration.search.TransportTwoServersSearchTests;
|
||||
import org.elasticsearch.test.integration.search.basic.TransportTwoNodesSearchTests;
|
||||
import org.elasticsearch.transport.TransportService;
|
||||
|
||||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class ClientTransportTwoServersSearchTests extends TransportTwoServersSearchTests {
|
||||
public class ClientTransportTwoNodesSearchTests extends TransportTwoNodesSearchTests {
|
||||
|
||||
@Override protected Client getClient() {
|
||||
TransportAddress server1Address = ((InternalNode) node("server1")).injector().getInstance(TransportService.class).boundAddress().publishAddress();
|
|
@ -1,9 +0,0 @@
|
|||
cluster:
|
||||
routing:
|
||||
schedule: 100ms
|
||||
index:
|
||||
number_of_shards: 3
|
||||
number_of_replicas: 0
|
||||
routing :
|
||||
# Use simple hashing since we want even distribution and our ids are simple incremented number based
|
||||
hash.type : simple
|
|
@ -1,6 +0,0 @@
|
|||
cluster:
|
||||
routing:
|
||||
schedule: 100ms
|
||||
index:
|
||||
number_of_shards: 1
|
||||
number_of_replicas: 0
|
|
@ -1,9 +0,0 @@
|
|||
cluster:
|
||||
routing:
|
||||
schedule: 100ms
|
||||
index:
|
||||
number_of_shards: 3
|
||||
number_of_replicas: 2
|
||||
routing :
|
||||
# Use simple hashing since we want even distribution and our ids are simple incremented number based
|
||||
hash.type : simple
|
|
@ -1,9 +0,0 @@
|
|||
cluster:
|
||||
routing:
|
||||
schedule: 100ms
|
||||
index:
|
||||
number_of_shards: 3
|
||||
number_of_replicas: 0
|
||||
routing :
|
||||
# Use simple hashing since we want even distribution and our ids are simple incremented number based
|
||||
hash.type : simple
|
|
@ -1,9 +0,0 @@
|
|||
cluster:
|
||||
routing:
|
||||
schedule: 100ms
|
||||
index:
|
||||
number_of_shards: 3
|
||||
number_of_replicas: 0
|
||||
routing :
|
||||
# Use simple hashing since we want even distribution and our ids are simple incremented number based
|
||||
hash.type : simple
|
|
@ -1,8 +0,0 @@
|
|||
cluster:
|
||||
routing:
|
||||
schedule: 100ms
|
||||
operation:
|
||||
type: org.elasticsearch.test.integration.search.TwoInstanceUnbalancedShardsEmbeddedSearchTests$UnevenOperationRoutingModule
|
||||
index:
|
||||
number_of_shards: 3
|
||||
number_of_replicas: 0
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.test.integration.search;
|
||||
package org.elasticsearch.test.integration.search.basic;
|
||||
|
||||
import org.elasticsearch.ElasticSearchException;
|
||||
import org.elasticsearch.action.WriteConsistencyLevel;
|
||||
|
@ -37,6 +37,7 @@ import org.testng.annotations.Test;
|
|||
import java.io.IOException;
|
||||
|
||||
import static org.elasticsearch.client.Requests.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.*;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.*;
|
||||
import static org.hamcrest.MatcherAssert.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
@ -53,7 +54,11 @@ public class TransportSearchFailuresTests extends AbstractNodesTests {
|
|||
@Test public void testFailedSearchWithWrongQuery() throws Exception {
|
||||
logger.info("Start Testing failed search with wrong query");
|
||||
startNode("server1");
|
||||
client("server1").admin().indices().create(createIndexRequest("test")).actionGet();
|
||||
client("server1").admin().indices().create(createIndexRequest("test")
|
||||
.settings(settingsBuilder().put("number_of_shards", 3).put("number_of_replicas", 2).put("routing.hash.type", "simple")))
|
||||
.actionGet();
|
||||
|
||||
client("server1").admin().cluster().prepareHealth().setWaitForYellowStatus().execute().actionGet();
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
index(client("server1"), Integer.toString(i), "test", i);
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.test.integration.search;
|
||||
package org.elasticsearch.test.integration.search.basic;
|
||||
|
||||
import org.elasticsearch.ElasticSearchException;
|
||||
import org.elasticsearch.action.search.SearchPhaseExecutionException;
|
||||
|
@ -44,6 +44,7 @@ import java.util.Set;
|
|||
|
||||
import static org.elasticsearch.action.search.SearchType.*;
|
||||
import static org.elasticsearch.client.Requests.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.*;
|
||||
import static org.elasticsearch.common.unit.TimeValue.*;
|
||||
import static org.elasticsearch.common.xcontent.XContentFactory.*;
|
||||
import static org.elasticsearch.index.query.xcontent.QueryBuilders.*;
|
||||
|
@ -54,7 +55,7 @@ import static org.hamcrest.Matchers.*;
|
|||
/**
|
||||
* @author kimchy (shay.banon)
|
||||
*/
|
||||
public class TransportTwoServersSearchTests extends AbstractNodesTests {
|
||||
public class TransportTwoNodesSearchTests extends AbstractNodesTests {
|
||||
|
||||
private Client client;
|
||||
|
||||
|
@ -63,7 +64,11 @@ public class TransportTwoServersSearchTests extends AbstractNodesTests {
|
|||
startNode("server2");
|
||||
client = getClient();
|
||||
|
||||
client.admin().indices().create(createIndexRequest("test")).actionGet();
|
||||
client.admin().indices().create(createIndexRequest("test")
|
||||
.settings(settingsBuilder().put("number_of_shards", 3).put("number_of_replicas", 0).put("routing.hash.type", "simple")))
|
||||
.actionGet();
|
||||
|
||||
client.admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
index(client("server1"), Integer.toString(i), "test", i);
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.test.integration.search;
|
||||
package org.elasticsearch.test.integration.search.embedded;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.common.trove.ExtTIntArrayList;
|
||||
|
@ -49,6 +49,7 @@ import java.util.Map;
|
|||
|
||||
import static org.elasticsearch.client.Requests.*;
|
||||
import static org.elasticsearch.common.collect.Lists.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.*;
|
||||
import static org.elasticsearch.index.query.xcontent.QueryBuilders.*;
|
||||
import static org.elasticsearch.search.builder.SearchSourceBuilder.*;
|
||||
import static org.hamcrest.MatcherAssert.*;
|
||||
|
@ -66,7 +67,10 @@ public class SingleInstanceEmbeddedSearchTests extends AbstractNodesTests {
|
|||
@BeforeClass public void createNodeAndInitWithData() throws Exception {
|
||||
startNode("server1");
|
||||
|
||||
client("server1").admin().indices().create(createIndexRequest("test")).actionGet();
|
||||
client("server1").admin().indices().prepareCreate("test")
|
||||
.setSettings(settingsBuilder().put("number_of_shards", 1).put("number_of_replicas", 0))
|
||||
.execute().actionGet();
|
||||
client("server1").admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
|
||||
index(client("server1"), "1", "test1", 1);
|
||||
index(client("server1"), "2", "test2", 2);
|
||||
index(client("server1"), "3", "test3", 2);
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.test.integration.search;
|
||||
package org.elasticsearch.test.integration.search.embedded;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.Requests;
|
||||
|
@ -28,7 +28,6 @@ import org.elasticsearch.common.collect.ImmutableMap;
|
|||
import org.elasticsearch.common.collect.Sets;
|
||||
import org.elasticsearch.common.trove.ExtTIntArrayList;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.search.*;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
|
@ -61,6 +60,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import static org.elasticsearch.client.Requests.*;
|
||||
import static org.elasticsearch.common.collect.Lists.*;
|
||||
import static org.elasticsearch.common.collect.Maps.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.*;
|
||||
import static org.elasticsearch.common.unit.TimeValue.*;
|
||||
import static org.elasticsearch.index.query.xcontent.QueryBuilders.*;
|
||||
import static org.elasticsearch.search.builder.SearchSourceBuilder.*;
|
||||
|
@ -72,8 +72,6 @@ import static org.hamcrest.Matchers.*;
|
|||
*/
|
||||
public class TwoInstanceEmbeddedSearchTests extends AbstractNodesTests {
|
||||
|
||||
private IndicesService indicesService;
|
||||
|
||||
private ClusterService clusterService;
|
||||
|
||||
private Map<String, SearchService> nodeToSearchService;
|
||||
|
@ -85,8 +83,9 @@ public class TwoInstanceEmbeddedSearchTests extends AbstractNodesTests {
|
|||
startNode("server2");
|
||||
|
||||
clusterService = ((InternalNode) node("server1")).injector().getInstance(ClusterService.class);
|
||||
indicesService = ((InternalNode) node("server1")).injector().getInstance(IndicesService.class);
|
||||
client("server1").admin().indices().create(Requests.createIndexRequest("test")).actionGet();
|
||||
client("server1").admin().indices().create(Requests.createIndexRequest("test")
|
||||
.settings(settingsBuilder().put("number_of_shards", 3).put("number_of_replicas", 0)))
|
||||
.actionGet();
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
index(client("server1"), Integer.toString(i), "test", i);
|
|
@ -17,7 +17,7 @@
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.test.integration.search;
|
||||
package org.elasticsearch.test.integration.search.embedded;
|
||||
|
||||
import org.elasticsearch.client.Client;
|
||||
import org.elasticsearch.client.Requests;
|
||||
|
@ -29,10 +29,10 @@ import org.elasticsearch.cluster.routing.operation.plain.PlainOperationRouting;
|
|||
import org.elasticsearch.common.collect.ImmutableMap;
|
||||
import org.elasticsearch.common.inject.AbstractModule;
|
||||
import org.elasticsearch.common.inject.Inject;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.trove.ExtTIntArrayList;
|
||||
import org.elasticsearch.common.unit.TimeValue;
|
||||
import org.elasticsearch.indices.IndicesService;
|
||||
import org.elasticsearch.node.internal.InternalNode;
|
||||
import org.elasticsearch.search.*;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
|
@ -63,6 +63,7 @@ import java.util.concurrent.TimeUnit;
|
|||
import static org.elasticsearch.client.Requests.*;
|
||||
import static org.elasticsearch.common.collect.Lists.*;
|
||||
import static org.elasticsearch.common.collect.Maps.*;
|
||||
import static org.elasticsearch.common.settings.ImmutableSettings.*;
|
||||
import static org.elasticsearch.common.unit.TimeValue.*;
|
||||
import static org.elasticsearch.index.query.xcontent.QueryBuilders.*;
|
||||
import static org.elasticsearch.search.builder.SearchSourceBuilder.*;
|
||||
|
@ -75,8 +76,6 @@ import static org.hamcrest.Matchers.*;
|
|||
*/
|
||||
public class TwoInstanceUnbalancedShardsEmbeddedSearchTests extends AbstractNodesTests {
|
||||
|
||||
private IndicesService indicesService;
|
||||
|
||||
private ClusterService clusterService;
|
||||
|
||||
private Map<String, SearchService> nodeToSearchService;
|
||||
|
@ -84,13 +83,17 @@ public class TwoInstanceUnbalancedShardsEmbeddedSearchTests extends AbstractNode
|
|||
private SearchPhaseController searchPhaseController;
|
||||
|
||||
@BeforeClass public void createNodeAndInitWithData() throws Exception {
|
||||
startNode("server1");
|
||||
startNode("server2");
|
||||
ImmutableSettings.Builder nodeSettings = ImmutableSettings.settingsBuilder()
|
||||
.put("cluster.routing.operation.type", "org.elasticsearch.test.integration.search.embedded.TwoInstanceUnbalancedShardsEmbeddedSearchTests$UnevenOperationRoutingModule");
|
||||
startNode("server1", nodeSettings);
|
||||
startNode("server2", nodeSettings);
|
||||
|
||||
clusterService = ((InternalNode) node("server1")).injector().getInstance(ClusterService.class);
|
||||
indicesService = ((InternalNode) node("server1")).injector().getInstance(IndicesService.class);
|
||||
|
||||
client("server1").admin().indices().create(Requests.createIndexRequest("test")).actionGet();
|
||||
client("server1").admin().indices().create(Requests.createIndexRequest("test")
|
||||
.settings(settingsBuilder().put("number_of_shards", 3).put("number_of_replicas", 0)))
|
||||
.actionGet();
|
||||
client("server1").admin().cluster().prepareHealth().setWaitForGreenStatus().execute().actionGet();
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
index(client("server1"), Integer.toString(i), "test", i);
|
Loading…
Reference in New Issue