Skip to content

Commit

Permalink
fix internalClusterTests
Browse files Browse the repository at this point in the history
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
  • Loading branch information
nknize committed Feb 18, 2022
1 parent 1624b8d commit 2173446
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ public void testBulkUpdateLargerVolume() throws Exception {
assertThat(response.getItems()[i].getId(), equalTo(Integer.toString(i)));
assertThat(response.getItems()[i].getVersion(), equalTo(2L));
assertThat(response.getItems()[i].getIndex(), equalTo("test"));
assertThat(response.getItems()[i].getType(), equalTo("type1"));
assertThat(response.getItems()[i].getOpType(), equalTo(OpType.UPDATE));
assertThat(response.getItems()[i].getResponse().getId(), equalTo(Integer.toString(i)));
assertThat(response.getItems()[i].getResponse().getVersion(), equalTo(2L));
Expand All @@ -503,7 +502,6 @@ public void testBulkUpdateLargerVolume() throws Exception {
assertThat(response.getItems()[i].getId(), equalTo(Integer.toString(id)));
assertThat(response.getItems()[i].getVersion(), equalTo(3L));
assertThat(response.getItems()[i].getIndex(), equalTo("test"));
assertThat(response.getItems()[i].getType(), equalTo("type1"));
assertThat(response.getItems()[i].getOpType(), equalTo(OpType.UPDATE));
}
}
Expand All @@ -525,7 +523,6 @@ public void testBulkUpdateLargerVolume() throws Exception {
assertThat(response.getItems()[i].getItemId(), equalTo(i));
assertThat(response.getItems()[i].getId(), equalTo(Integer.toString(i)));
assertThat(response.getItems()[i].getIndex(), equalTo("test"));
assertThat(response.getItems()[i].getType(), equalTo("type1"));
assertThat(response.getItems()[i].getOpType(), equalTo(OpType.UPDATE));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public void testSingleNodeNoFlush() throws Exception {
int numberOfShards = numberOfShards();
assertAcked(
prepareCreate("test").setSettings(
Settings.builder().put(SETTING_NUMBER_OF_SHARDS, numberOfShards()).put(SETTING_NUMBER_OF_REPLICAS, randomIntBetween(0, 1))
Settings.builder().put("index.codec", "Lucene86").put(SETTING_NUMBER_OF_SHARDS, numberOfShards()).put(SETTING_NUMBER_OF_REPLICAS, randomIntBetween(0, 1))
).addMapping("type1", mapping, XContentType.JSON)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ public void testRequiredRoutingCrudApis() throws Exception {
fail();
} catch (RoutingMissingException e) {
assertThat(e.status(), equalTo(RestStatus.BAD_REQUEST));
assertThat(e.getMessage(), equalTo("routing is required for [test]/[type1]/[1]"));
assertThat(e.getMessage(), equalTo("routing is required for [test]/[1]"));
}
GetResponse getResponse = client().prepareGet(indexOrAlias(), "1").setRouting(routingValue).execute().actionGet();
assertThat(getResponse.isExists(), equalTo(true));
Expand All @@ -440,7 +440,7 @@ public void testRequiredRoutingCrudApis() throws Exception {
fail();
} catch (RoutingMissingException e) {
assertThat(e.status(), equalTo(RestStatus.BAD_REQUEST));
assertThat(e.getMessage(), equalTo("routing is required for [test]/[type1]/[1]"));
assertThat(e.getMessage(), equalTo("routing is required for [test]/[1]"));
}
assertThat(client().prepareGet(indexOrAlias(), "1").setRouting(routingValue).execute().actionGet().isExists(), equalTo(false));
}
Expand Down Expand Up @@ -509,7 +509,7 @@ public void testRequiredRoutingBulk() throws Exception {
assertThat(bulkItemResponse.getOpType(), equalTo(DocWriteRequest.OpType.UPDATE));
assertThat(bulkItemResponse.getFailure().getStatus(), equalTo(RestStatus.BAD_REQUEST));
assertThat(bulkItemResponse.getFailure().getCause(), instanceOf(RoutingMissingException.class));
assertThat(bulkItemResponse.getFailureMessage(), containsString("routing is required for [test]/[type1]/[1]"));
assertThat(bulkItemResponse.getFailureMessage(), containsString("routing is required for [test]/[1]"));
}
}

Expand All @@ -534,7 +534,7 @@ public void testRequiredRoutingBulk() throws Exception {
assertThat(bulkItemResponse.getOpType(), equalTo(DocWriteRequest.OpType.DELETE));
assertThat(bulkItemResponse.getFailure().getStatus(), equalTo(RestStatus.BAD_REQUEST));
assertThat(bulkItemResponse.getFailure().getCause(), instanceOf(RoutingMissingException.class));
assertThat(bulkItemResponse.getFailureMessage(), containsString("routing is required for [test]/[type1]/[1]"));
assertThat(bulkItemResponse.getFailureMessage(), containsString("routing is required for [test]/[1]"));
}
}

Expand Down Expand Up @@ -602,7 +602,7 @@ public void testRequiredRoutingMappingVariousAPIs() throws Exception {
client().prepareExplain(indexOrAlias(), "type1", "2").setQuery(QueryBuilders.matchAllQuery()).get();
fail();
} catch (RoutingMissingException e) {
assertThat(e.getMessage(), equalTo("routing is required for [test]/[type1]/[2]"));
assertThat(e.getMessage(), equalTo("routing is required for [test]/[2]"));
}

logger.info("--> verifying term vector with id [1], with routing [0], should succeed");
Expand All @@ -614,7 +614,7 @@ public void testRequiredRoutingMappingVariousAPIs() throws Exception {
client().prepareTermVectors(indexOrAlias(), "1").get();
fail();
} catch (RoutingMissingException e) {
assertThat(e.getMessage(), equalTo("routing is required for [test]/[_doc]/[1]"));
assertThat(e.getMessage(), equalTo("routing is required for [test]/[1]"));
}

UpdateResponse updateResponse = client().prepareUpdate(indexOrAlias(), "type1", "1")
Expand All @@ -628,7 +628,7 @@ public void testRequiredRoutingMappingVariousAPIs() throws Exception {
client().prepareUpdate(indexOrAlias(), "type1", "1").setDoc(Requests.INDEX_CONTENT_TYPE, "field1", "value1").get();
fail();
} catch (RoutingMissingException e) {
assertThat(e.getMessage(), equalTo("routing is required for [test]/[type1]/[1]"));
assertThat(e.getMessage(), equalTo("routing is required for [test]/[1]"));
}

logger.info("--> verifying mget with ids [1,2], with routing [0], should succeed");
Expand All @@ -650,10 +650,10 @@ public void testRequiredRoutingMappingVariousAPIs() throws Exception {
assertThat(multiGetResponse.getResponses().length, equalTo(2));
assertThat(multiGetResponse.getResponses()[0].isFailed(), equalTo(true));
assertThat(multiGetResponse.getResponses()[0].getFailure().getId(), equalTo("1"));
assertThat(multiGetResponse.getResponses()[0].getFailure().getMessage(), equalTo("routing is required for [test]/[type1]/[1]"));
assertThat(multiGetResponse.getResponses()[0].getFailure().getMessage(), equalTo("routing is required for [test]/[1]"));
assertThat(multiGetResponse.getResponses()[1].isFailed(), equalTo(true));
assertThat(multiGetResponse.getResponses()[1].getFailure().getId(), equalTo("2"));
assertThat(multiGetResponse.getResponses()[1].getFailure().getMessage(), equalTo("routing is required for [test]/[type1]/[2]"));
assertThat(multiGetResponse.getResponses()[1].getFailure().getMessage(), equalTo("routing is required for [test]/[2]"));

MultiTermVectorsResponse multiTermVectorsResponse = client().prepareMultiTermVectors()
.add(new TermVectorsRequest(indexOrAlias(), "1").routing(routingValue))
Expand All @@ -678,15 +678,15 @@ public void testRequiredRoutingMappingVariousAPIs() throws Exception {
assertThat(multiTermVectorsResponse.getResponses()[0].isFailed(), equalTo(true));
assertThat(
multiTermVectorsResponse.getResponses()[0].getFailure().getCause().getMessage(),
equalTo("routing is required for [test]/[_doc]/[1]")
equalTo("routing is required for [test]/[1]")
);
assertThat(multiTermVectorsResponse.getResponses()[0].getResponse(), nullValue());
assertThat(multiTermVectorsResponse.getResponses()[1].getId(), equalTo("2"));
assertThat(multiTermVectorsResponse.getResponses()[1].isFailed(), equalTo(true));
assertThat(multiTermVectorsResponse.getResponses()[1].getResponse(), nullValue());
assertThat(
multiTermVectorsResponse.getResponses()[1].getFailure().getCause().getMessage(),
equalTo("routing is required for [test]/[_doc]/[2]")
equalTo("routing is required for [test]/[2]")
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,6 @@ public void testContextVariables() throws Exception {
getResponse = client().prepareGet("test", "id2").execute().actionGet();
updateContext = (Map<String, Object>) getResponse.getSourceAsMap().get("update_context");
assertEquals("test", updateContext.get("_index"));
assertEquals("type1", updateContext.get("_type"));
assertEquals("id2", updateContext.get("_id"));
assertEquals(1, updateContext.get("_version"));
assertNull(updateContext.get("_routing"));
Expand Down

0 comments on commit 2173446

Please sign in to comment.