tests: more cloud atomic update tests

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1426373 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Yonik Seeley 2012-12-28 01:19:29 +00:00
parent 7e51f75561
commit 2c51c55a28
1 changed files with 24 additions and 1 deletions

View File

@ -41,6 +41,7 @@ import org.junit.Ignore;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -117,6 +118,7 @@ public class ShardRoutingTest extends AbstractFullDistribZkTestBase {
doHashingTest();
doTestNumRequests();
// doAtomicUpdate(); TODO: this currently fails!
testFinished = true;
} finally {
@ -130,6 +132,7 @@ public class ShardRoutingTest extends AbstractFullDistribZkTestBase {
private void doHashingTest() throws Exception {
log.info("### STARTING doHashingTest");
assertEquals(4, cloudClient.getZkStateReader().getClusterState().getCollection(DEFAULT_COLLECTION).getSlices().size());
String shardKeys = ShardParams.SHARD_KEYS;
// for now, we know how ranges will be distributed to shards.
@ -203,7 +206,12 @@ public class ShardRoutingTest extends AbstractFullDistribZkTestBase {
}
public void doTestNumRequests() throws Exception {
log.info("### STARTING doTestNumRequests");
List<CloudJettyRunner> runners = shardToJetty.get(bucket1);
CloudJettyRunner leader = shardToLeaderJetty.get(bucket1);
@ -257,8 +265,23 @@ public class ShardRoutingTest extends AbstractFullDistribZkTestBase {
assertEquals(5, nEnd - nStart); // original + 2 phase distrib search * 2 shards.
}
public void doAtomicUpdate() throws Exception {
log.info("### STARTING doAtomicUpdate");
int nClients = clients.size();
assertEquals(8, nClients);
long getNumRequests() {
int expectedVal = 0;
for (SolrServer client : clients) {
client.add(sdoc("id", "b!doc", "foo_i", map("inc",1)));
expectedVal++;
QueryResponse rsp = client.query(params("qt","/get", "id","b!doc"));
Object val = ((Map)rsp.getResponse().get("doc")).get("foo_i");
assertEquals((Integer)expectedVal, val);
}
}
long getNumRequests() {
long n = controlJetty.getDebugFilter().getTotalRequests();
for (JettySolrRunner jetty : jettys) {
n += jetty.getDebugFilter().getTotalRequests();