From 4fb79fe787acb79833465971c007c030cc969dee Mon Sep 17 00:00:00 2001 From: Areek Zillur Date: Mon, 14 Jul 2014 19:01:04 -0400 Subject: [PATCH] [TEST] fix random preference string test to accomodate for the new more strict preference type --- .../org/elasticsearch/count/simple/SimpleCountTests.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/test/java/org/elasticsearch/count/simple/SimpleCountTests.java b/src/test/java/org/elasticsearch/count/simple/SimpleCountTests.java index 8c066209bb0..e7329b2905e 100644 --- a/src/test/java/org/elasticsearch/count/simple/SimpleCountTests.java +++ b/src/test/java/org/elasticsearch/count/simple/SimpleCountTests.java @@ -47,8 +47,14 @@ public class SimpleCountTests extends ElasticsearchIntegrationTest { int iters = scaledRandomIntBetween(10, 100); for (int i = 0; i < iters; i++) { + + String randomPreference = randomUnicodeOfLengthBetween(0, 4); + // randomPreference should not start with '_' (reserved for known preference types (e.g. _shards, _primary) + while (randomPreference.startsWith("_")) { + randomPreference = randomUnicodeOfLengthBetween(0, 4); + } // id is not indexed, but lets see that we automatically convert to - CountResponse countResponse = client().prepareCount().setQuery(QueryBuilders.matchAllQuery()).setPreference(randomUnicodeOfLengthBetween(0, 4)).get(); + CountResponse countResponse = client().prepareCount().setQuery(QueryBuilders.matchAllQuery()).setPreference(randomPreference).get(); assertHitCount(countResponse, 6l); } }