more scan tests to try and recreate the context missing failure, no luck yet...

This commit is contained in:
kimchy 2011-03-28 17:21:59 +02:00
parent e0d8094f3d
commit f00664621f
1 changed files with 59 additions and 1 deletions

View File

@ -84,6 +84,18 @@ public class SearchScanTests extends AbstractNodesTests {
testScroll(1, 100, 89); testScroll(1, 100, 89);
} }
@Test public void shard1docs100size99() throws Exception {
testScroll(1, 100, 99);
}
@Test public void shard1docs100size100() throws Exception {
testScroll(1, 100, 100);
}
@Test public void shard1docs100size101() throws Exception {
testScroll(1, 100, 101);
}
@Test public void shard1docs100size120() throws Exception { @Test public void shard1docs100size120() throws Exception {
testScroll(1, 100, 120); testScroll(1, 100, 120);
} }
@ -120,7 +132,43 @@ public class SearchScanTests extends AbstractNodesTests {
testScroll(3, 100, 120); testScroll(3, 100, 120);
} }
@Test public void shard3docs100size3Unbalanced() throws Exception {
testScroll(3, 100, 3, true);
}
@Test public void shard3docs100size7Unbalanced() throws Exception {
testScroll(3, 100, 7, true);
}
@Test public void shard3docs100size13Unbalanced() throws Exception {
testScroll(3, 100, 13, true);
}
@Test public void shard3docs100size24Unbalanced() throws Exception {
testScroll(3, 100, 24, true);
}
@Test public void shard3docs100size45Unbalanced() throws Exception {
testScroll(3, 100, 45, true);
}
@Test public void shard3docs100size63Unbalanced() throws Exception {
testScroll(3, 100, 63, true);
}
@Test public void shard3docs100size89Unbalanced() throws Exception {
testScroll(3, 100, 89, true);
}
@Test public void shard3docs100size120Unbalanced() throws Exception {
testScroll(3, 100, 120);
}
private void testScroll(int numberOfShards, long numberOfDocs, int size) throws Exception { private void testScroll(int numberOfShards, long numberOfDocs, int size) throws Exception {
testScroll(numberOfShards, numberOfDocs, size, false);
}
private void testScroll(int numberOfShards, long numberOfDocs, int size, boolean unbalanced) throws Exception {
try { try {
client.admin().indices().prepareDelete("test").execute().actionGet(); client.admin().indices().prepareDelete("test").execute().actionGet();
} catch (Exception e) { } catch (Exception e) {
@ -134,7 +182,17 @@ public class SearchScanTests extends AbstractNodesTests {
for (int i = 0; i < numberOfDocs; i++) { for (int i = 0; i < numberOfDocs; i++) {
String id = Integer.toString(i); String id = Integer.toString(i);
expectedIds.add(id); expectedIds.add(id);
client.prepareIndex("test", "type1", id).setSource("field", i).execute().actionGet(); String routing = null;
if (unbalanced) {
if (i < (numberOfDocs * 0.6)) {
routing = "0";
} else if (i < (numberOfDocs * 0.9)) {
routing = "1";
} else {
routing = "2";
}
}
client.prepareIndex("test", "type1", id).setRouting(routing).setSource("field", i).execute().actionGet();
} }
client.admin().indices().prepareRefresh().execute().actionGet(); client.admin().indices().prepareRefresh().execute().actionGet();