[TEST] extend wait_for_active_shards randomization to include 'all' value
This was already changed in 6.x as part of the backport of the recently added open and create index API. wait_for_active_shards can be a number but also "all", with this commit we verify that providing "all" works too.
This commit is contained in:
parent
b35c459c96
commit
e01643126b
|
@ -38,6 +38,7 @@ import org.elasticsearch.action.search.MultiSearchRequest;
|
||||||
import org.elasticsearch.action.search.SearchRequest;
|
import org.elasticsearch.action.search.SearchRequest;
|
||||||
import org.elasticsearch.action.search.SearchScrollRequest;
|
import org.elasticsearch.action.search.SearchScrollRequest;
|
||||||
import org.elasticsearch.action.search.SearchType;
|
import org.elasticsearch.action.search.SearchType;
|
||||||
|
import org.elasticsearch.action.support.ActiveShardCount;
|
||||||
import org.elasticsearch.action.support.IndicesOptions;
|
import org.elasticsearch.action.support.IndicesOptions;
|
||||||
import org.elasticsearch.action.support.WriteRequest;
|
import org.elasticsearch.action.support.WriteRequest;
|
||||||
import org.elasticsearch.action.support.master.AcknowledgedRequest;
|
import org.elasticsearch.action.support.master.AcknowledgedRequest;
|
||||||
|
@ -1019,11 +1020,17 @@ public class RequestTests extends ESTestCase {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setRandomWaitForActiveShards(Consumer<Integer> setter, Map<String, String> expectedParams) {
|
private static void setRandomWaitForActiveShards(Consumer<ActiveShardCount> setter, Map<String, String> expectedParams) {
|
||||||
if (randomBoolean()) {
|
if (randomBoolean()) {
|
||||||
int waitForActiveShards = randomIntBetween(0, 10);
|
String waitForActiveShardsString;
|
||||||
setter.accept(waitForActiveShards);
|
int waitForActiveShards = randomIntBetween(-1, 5);
|
||||||
expectedParams.put("wait_for_active_shards", String.valueOf(waitForActiveShards));
|
if (waitForActiveShards == -1) {
|
||||||
|
waitForActiveShardsString = "all";
|
||||||
|
} else {
|
||||||
|
waitForActiveShardsString = String.valueOf(waitForActiveShards);
|
||||||
|
}
|
||||||
|
setter.accept(ActiveShardCount.parseString(waitForActiveShardsString));
|
||||||
|
expectedParams.put("wait_for_active_shards", waitForActiveShardsString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue