Skip to content

Commit

Permalink
more test failure fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Nicholas Walter Knize <[email protected]>
  • Loading branch information
nknize committed Feb 18, 2022
1 parent c00e0e9 commit 1624b8d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,6 @@ public void testBulkUpdateLargerVolume() throws Exception {
assertThat(response.getItems()[i].getId(), equalTo(Integer.toString(i)));
assertThat(response.getItems()[i].getVersion(), equalTo(1L));
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(1L));
Expand Down Expand Up @@ -550,7 +549,6 @@ public void testBulkUpdateLargerVolume() throws Exception {
assertThat(itemResponse.getItemId(), equalTo(i));
assertThat(itemResponse.getId(), equalTo(Integer.toString(i)));
assertThat(itemResponse.getIndex(), equalTo("test"));
assertThat(itemResponse.getType(), equalTo("type1"));
assertThat(itemResponse.getOpType(), equalTo(OpType.UPDATE));
for (int j = 0; j < 5; j++) {
GetResponse getResponse = client().prepareGet("test", Integer.toString(i)).get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,13 @@ public void testNoMasterActions() throws Exception {
);

assertRequestBuilderThrows(
clientToMasterlessNode.prepareMultiGet().add("test", "type1", "1"),
clientToMasterlessNode.prepareMultiGet().add("test", "1"),
ClusterBlockException.class,
RestStatus.SERVICE_UNAVAILABLE
);

assertRequestBuilderThrows(
clientToMasterlessNode.prepareMultiGet().add("no_index", "type1", "1"),
clientToMasterlessNode.prepareMultiGet().add("no_index", "1"),
ClusterBlockException.class,
RestStatus.SERVICE_UNAVAILABLE
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ public void testExplainWithFilteredAliasFetchSource() throws Exception {
assertThat(response.getId(), equalTo("1"));
assertThat(response.getGetResult(), notNullValue());
assertThat(response.getGetResult().getIndex(), equalTo("test"));
assertThat(response.getGetResult(), equalTo("test"));
assertThat(response.getGetResult().getId(), equalTo("1"));
assertThat(response.getGetResult().getSource(), notNullValue());
assertThat((String) response.getGetResult().getSource().get("field1"), equalTo("value1"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ public void testRequiredRoutingCrudApis() throws Exception {
fail("get with missing routing when routing is required should 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(true));
}
Expand Down Expand Up @@ -478,7 +478,7 @@ public void testRequiredRoutingBulk() throws Exception {
assertThat(bulkItemResponse.getOpType(), equalTo(DocWriteRequest.OpType.INDEX));
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 @@ -586,7 +586,7 @@ public void testRequiredRoutingMappingVariousAPIs() throws Exception {
client().prepareGet(indexOrAlias(), "1").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 explain with id [2], with routing [0], should succeed");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,6 @@ public void testContextVariables() throws Exception {
GetResponse getResponse = client().prepareGet("test", "id1").setRouting("routing1").execute().actionGet();
Map<String, Object> updateContext = (Map<String, Object>) getResponse.getSourceAsMap().get("update_context");
assertEquals("test", updateContext.get("_index"));
assertEquals("type1", updateContext.get("_type"));
assertEquals("id1", updateContext.get("_id"));
assertEquals(1, updateContext.get("_version"));
assertEquals("routing1", updateContext.get("_routing"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ public static void assertHitCount(SearchResponse countResponse, long expectedHit
}

public static void assertExists(GetResponse response) {
String message = String.format(Locale.ROOT, "Expected %s/%s/%s to exist, but does not", response.getIndex(), response.getId());
String message = String.format(Locale.ROOT, "Expected %s/%s to exist, but does not", response.getIndex(), response.getId());
assertThat(message, response.isExists(), is(true));
}

Expand Down

0 comments on commit 1624b8d

Please sign in to comment.