Fixing Rest Converters Tests after x-pack removal (#54)
Signed-off-by: Peter Nied <petern@amazon.com>
This commit is contained in:
parent
f2a90be773
commit
ae46de3125
|
@ -199,13 +199,6 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
expectedParams.put("realtime", "false");
|
||||
}
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
boolean refresh = randomBoolean();
|
||||
getRequest.refresh(refresh);
|
||||
if (refresh) {
|
||||
expectedParams.put("refresh", "true");
|
||||
}
|
||||
}
|
||||
Request request = RequestConverters.sourceExists(getRequest);
|
||||
assertEquals(HttpHead.METHOD_NAME, request.getMethod());
|
||||
String type = getRequest.type();
|
||||
|
@ -242,13 +235,6 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
expectedParams.put("realtime", "false");
|
||||
}
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
boolean refresh = randomBoolean();
|
||||
getRequest.refresh(refresh);
|
||||
if (refresh) {
|
||||
expectedParams.put("refresh", "true");
|
||||
}
|
||||
}
|
||||
Request request = RequestConverters.getSource(getRequest);
|
||||
assertEquals(HttpGet.METHOD_NAME, request.getMethod());
|
||||
assertEquals("/" + index + "/_source/" + id, request.getEndpoint());
|
||||
|
@ -271,12 +257,6 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
expectedParams.put("realtime", "false");
|
||||
}
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
multiGetRequest.refresh(randomBoolean());
|
||||
if (multiGetRequest.refresh()) {
|
||||
expectedParams.put("refresh", "true");
|
||||
}
|
||||
}
|
||||
|
||||
int numberOfRequests = randomIntBetween(0, 32);
|
||||
for (int i = 0; i < numberOfRequests; i++) {
|
||||
|
@ -327,7 +307,6 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
Map<String, String> expectedParams = new HashMap<>();
|
||||
|
||||
setRandomTimeout(deleteRequest::timeout, ReplicationRequest.DEFAULT_TIMEOUT, expectedParams);
|
||||
setRandomRefreshPolicy(deleteRequest::setRefreshPolicy, expectedParams);
|
||||
setRandomVersion(deleteRequest, expectedParams);
|
||||
setRandomVersionType(deleteRequest::versionType, expectedParams);
|
||||
setRandomIfSeqNoAndTerm(deleteRequest, expectedParams);
|
||||
|
@ -391,13 +370,6 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
expectedParams.put("realtime", "false");
|
||||
}
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
boolean refresh = randomBoolean();
|
||||
getRequest.refresh(refresh);
|
||||
if (refresh) {
|
||||
expectedParams.put("refresh", "true");
|
||||
}
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
long version = randomLong();
|
||||
getRequest.version(version);
|
||||
|
@ -721,7 +693,6 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
}
|
||||
|
||||
setRandomTimeout(indexRequest::timeout, ReplicationRequest.DEFAULT_TIMEOUT, expectedParams);
|
||||
setRandomRefreshPolicy(indexRequest::setRefreshPolicy, expectedParams);
|
||||
|
||||
// There is some logic around _create endpoint and version/version type
|
||||
if (indexRequest.opType() == DocWriteRequest.OpType.CREATE) {
|
||||
|
@ -858,13 +829,6 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
} else {
|
||||
expectedParams.put("timeout", ReplicationRequest.DEFAULT_TIMEOUT.getStringRep());
|
||||
}
|
||||
if (randomBoolean()) {
|
||||
WriteRequest.RefreshPolicy refreshPolicy = randomFrom(WriteRequest.RefreshPolicy.values());
|
||||
updateRequest.setRefreshPolicy(refreshPolicy);
|
||||
if (refreshPolicy != WriteRequest.RefreshPolicy.NONE) {
|
||||
expectedParams.put("refresh", refreshPolicy.getValue());
|
||||
}
|
||||
}
|
||||
setRandomWaitForActiveShards(updateRequest::waitForActiveShards, expectedParams);
|
||||
setRandomIfSeqNoAndTerm(updateRequest, new HashMap<>()); // if* params are passed in the body
|
||||
if (randomBoolean()) {
|
||||
|
@ -967,7 +931,6 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
expectedParams.put("timeout", BulkShardRequest.DEFAULT_TIMEOUT.getStringRep());
|
||||
}
|
||||
|
||||
setRandomRefreshPolicy(bulkRequest::setRefreshPolicy, expectedParams);
|
||||
|
||||
XContentType xContentType = randomFrom(XContentType.JSON, XContentType.SMILE);
|
||||
|
||||
|
@ -2240,16 +2203,6 @@ public class RequestConvertersTests extends ESTestCase {
|
|||
}
|
||||
}
|
||||
|
||||
private static void setRandomRefreshPolicy(Consumer<WriteRequest.RefreshPolicy> setter, Map<String, String> expectedParams) {
|
||||
if (randomBoolean()) {
|
||||
WriteRequest.RefreshPolicy refreshPolicy = randomFrom(WriteRequest.RefreshPolicy.values());
|
||||
setter.accept(refreshPolicy);
|
||||
if (refreshPolicy != WriteRequest.RefreshPolicy.NONE) {
|
||||
expectedParams.put("refresh", refreshPolicy.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setRandomVersion(DocWriteRequest<?> request, Map<String, String> expectedParams) {
|
||||
if (randomBoolean()) {
|
||||
long version = randomFrom(Versions.MATCH_ANY, Versions.MATCH_DELETED, Versions.NOT_FOUND, randomNonNegativeLong());
|
||||
|
|
Loading…
Reference in New Issue