From f00664621f2b88617148afa507e328b07413cbca Mon Sep 17 00:00:00 2001 From: kimchy Date: Mon, 28 Mar 2011 17:21:59 +0200 Subject: [PATCH] more scan tests to try and recreate the context missing failure, no luck yet... --- .../search/scan/SearchScanTests.java | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/scan/SearchScanTests.java b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/scan/SearchScanTests.java index ea4c2832649..ae43d5cac21 100644 --- a/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/scan/SearchScanTests.java +++ b/modules/test/integration/src/test/java/org/elasticsearch/test/integration/search/scan/SearchScanTests.java @@ -84,6 +84,18 @@ public class SearchScanTests extends AbstractNodesTests { 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 { testScroll(1, 100, 120); } @@ -120,7 +132,43 @@ public class SearchScanTests extends AbstractNodesTests { 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 { + testScroll(numberOfShards, numberOfDocs, size, false); + } + + private void testScroll(int numberOfShards, long numberOfDocs, int size, boolean unbalanced) throws Exception { try { client.admin().indices().prepareDelete("test").execute().actionGet(); } catch (Exception e) { @@ -134,7 +182,17 @@ public class SearchScanTests extends AbstractNodesTests { for (int i = 0; i < numberOfDocs; i++) { String id = Integer.toString(i); 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();