no need doc action test to check count in before class
- also, since we randomize client transports, no need for specific classes to test for it, we test different clients across all our tests
This commit is contained in:
parent
3db8be6c77
commit
eb9c0d077b
|
@ -1,60 +0,0 @@
|
|||
/*
|
||||
* Licensed to ElasticSearch and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. ElasticSearch licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.test.integration.client.transport;
|
||||
|
||||
import org.elasticsearch.client.transport.TransportClient;
|
||||
import org.elasticsearch.common.network.NetworkUtils;
|
||||
import org.elasticsearch.common.settings.ImmutableSettings;
|
||||
import org.elasticsearch.test.integration.AbstractNodesTests;
|
||||
import org.junit.After;
|
||||
import org.junit.Ignore;
|
||||
|
||||
import static org.elasticsearch.client.Requests.createIndexRequest;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class DiscoveryTransportClientTests extends AbstractNodesTests {
|
||||
|
||||
private TransportClient client;
|
||||
|
||||
@After
|
||||
public void closeServers() {
|
||||
if (client != null) {
|
||||
client.close();
|
||||
}
|
||||
closeAllNodes();
|
||||
}
|
||||
|
||||
/*@Test*/
|
||||
@Ignore("fails for some reason?")
|
||||
public void testWithDiscovery() throws Exception {
|
||||
startNode("server1");
|
||||
client = new TransportClient(ImmutableSettings.settingsBuilder()
|
||||
.put("cluster.name", "test-cluster-" + NetworkUtils.getLocalAddress().getHostName())
|
||||
.put("discovery.enabled", true)
|
||||
.build());
|
||||
// wait a bit so nodes will be discovered
|
||||
Thread.sleep(1000);
|
||||
client.admin().indices().create(createIndexRequest("test")).actionGet();
|
||||
Thread.sleep(500);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/*
|
||||
* Licensed to Elastic Search and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. Elastic Search licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.test.integration.client.transport;
|
||||
|
||||
import org.elasticsearch.test.integration.TestCluster;
|
||||
import org.elasticsearch.test.integration.document.DocumentActionsTests;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TransportClientDocumentActionsTests extends DocumentActionsTests {
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeTransportClientDocumentActionsTests() throws Exception {
|
||||
cluster().setClientFactory(TestCluster.TransportClientFactory.NO_SNIFF_CLIENT_FACTORY);
|
||||
DocumentActionsTests.beforeDocumentActionsTests();
|
||||
}
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* Licensed to ElasticSearch and Shay Banon under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. ElasticSearch licenses this
|
||||
* file to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.elasticsearch.test.integration.client.transport;
|
||||
|
||||
import org.elasticsearch.test.integration.TestCluster;
|
||||
import org.elasticsearch.test.integration.document.DocumentActionsTests;
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public class TransportClientSniffDocumentActionsTests extends DocumentActionsTests {
|
||||
|
||||
@BeforeClass
|
||||
public static void beforTransportClientSniffDocumentActionsTests() throws Exception {
|
||||
DocumentActionsTests.beforeDocumentActionsTests();
|
||||
cluster().setClientFactory(TestCluster.TransportClientFactory.SNIFF_CLIENT_FACTORY);
|
||||
DocumentActionsTests.beforeDocumentActionsTests();
|
||||
|
||||
}
|
||||
}
|
|
@ -37,7 +37,6 @@ import org.elasticsearch.action.support.replication.ReplicationType;
|
|||
import org.elasticsearch.common.xcontent.XContentBuilder;
|
||||
import org.elasticsearch.common.xcontent.XContentFactory;
|
||||
import org.elasticsearch.test.integration.AbstractSharedClusterTest;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.IOException;
|
||||
|
@ -53,25 +52,15 @@ import static org.hamcrest.Matchers.nullValue;
|
|||
*
|
||||
*/
|
||||
public class DocumentActionsTests extends AbstractSharedClusterTest {
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeDocumentActionsTests() throws Exception {
|
||||
AbstractSharedClusterTest.beforeClass();
|
||||
wipeIndices();
|
||||
// no indices, check that simple operations fail
|
||||
try {
|
||||
client().prepareCount("test").setQuery(termQuery("_type", "type1")).setOperationThreading(BroadcastOperationThreading.NO_THREADS).execute().actionGet();
|
||||
assert false : "should fail";
|
||||
} catch (Exception e) {
|
||||
// all is well
|
||||
}
|
||||
client().prepareCount().setQuery(termQuery("_type", "type1")).setOperationThreading(BroadcastOperationThreading.NO_THREADS).execute().actionGet();
|
||||
cluster().ensureAtLeastNumNodes(2);
|
||||
|
||||
@Override
|
||||
protected int numberOfNodes() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
protected void createIndex() {
|
||||
wipeIndex(getConcreteIndexName());
|
||||
createIndex(getConcreteIndexName());
|
||||
wipeIndex(getConcreteIndexName());
|
||||
createIndex(getConcreteIndexName());
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,7 +81,7 @@ public class DocumentActionsTests extends AbstractSharedClusterTest {
|
|||
logger.info("Refreshing");
|
||||
RefreshResponse refreshResponse = refresh();
|
||||
assertThat(refreshResponse.getSuccessfulShards(), equalTo(10));
|
||||
|
||||
|
||||
logger.info("--> index exists?");
|
||||
assertThat(indexExists(getConcreteIndexName()), equalTo(true));
|
||||
logger.info("--> index exists?, fake index");
|
||||
|
@ -102,7 +91,7 @@ public class DocumentActionsTests extends AbstractSharedClusterTest {
|
|||
ClearIndicesCacheResponse clearIndicesCacheResponse = client().admin().indices().clearCache(clearIndicesCacheRequest("test").recycler(true).fieldDataCache(true).filterCache(true).idCache(true)).actionGet();
|
||||
assertNoFailures(clearIndicesCacheResponse);
|
||||
assertThat(clearIndicesCacheResponse.getSuccessfulShards(), equalTo(10));
|
||||
|
||||
|
||||
logger.info("Optimizing");
|
||||
waitForRelocation(ClusterHealthStatus.GREEN);
|
||||
OptimizeResponse optimizeResponse = optimize();
|
||||
|
@ -203,7 +192,7 @@ public class DocumentActionsTests extends AbstractSharedClusterTest {
|
|||
|
||||
// count with no query is a match all one
|
||||
countResponse = client().prepareCount("test").execute().actionGet();
|
||||
assertThat("Failures " + countResponse.getShardFailures(), countResponse.getShardFailures()==null?0:countResponse.getShardFailures().length, equalTo(0));
|
||||
assertThat("Failures " + countResponse.getShardFailures(), countResponse.getShardFailures() == null ? 0 : countResponse.getShardFailures().length, equalTo(0));
|
||||
assertThat(countResponse.getCount(), equalTo(2l));
|
||||
assertThat(countResponse.getSuccessfulShards(), equalTo(5));
|
||||
assertThat(countResponse.getFailedShards(), equalTo(0));
|
||||
|
|
Loading…
Reference in New Issue