From 1624b8d73a94e8f9714f482214afed5eb659063b Mon Sep 17 00:00:00 2001 From: Nicholas Walter Knize Date: Fri, 18 Feb 2022 16:04:00 -0600 Subject: [PATCH] more test failure fixes Signed-off-by: Nicholas Walter Knize --- .../java/org/opensearch/action/bulk/BulkWithUpdatesIT.java | 2 -- .../java/org/opensearch/cluster/NoMasterNodeIT.java | 4 ++-- .../java/org/opensearch/explain/ExplainActionIT.java | 1 - .../java/org/opensearch/routing/SimpleRoutingIT.java | 6 +++--- .../java/org/opensearch/update/UpdateIT.java | 1 - .../org/opensearch/test/hamcrest/OpenSearchAssertions.java | 2 +- 6 files changed, 6 insertions(+), 10 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/action/bulk/BulkWithUpdatesIT.java b/server/src/internalClusterTest/java/org/opensearch/action/bulk/BulkWithUpdatesIT.java index 391e741e411a1..cf091fff03d3e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/bulk/BulkWithUpdatesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/bulk/BulkWithUpdatesIT.java @@ -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)); @@ -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(); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java index 746aa4c1a8af1..f8f686b27f29b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java @@ -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 ); diff --git a/server/src/internalClusterTest/java/org/opensearch/explain/ExplainActionIT.java b/server/src/internalClusterTest/java/org/opensearch/explain/ExplainActionIT.java index 4833a36dd8726..152d55e8fea88 100644 --- a/server/src/internalClusterTest/java/org/opensearch/explain/ExplainActionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/explain/ExplainActionIT.java @@ -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")); diff --git a/server/src/internalClusterTest/java/org/opensearch/routing/SimpleRoutingIT.java b/server/src/internalClusterTest/java/org/opensearch/routing/SimpleRoutingIT.java index bff90e219e281..99a1eb3361c33 100644 --- a/server/src/internalClusterTest/java/org/opensearch/routing/SimpleRoutingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/routing/SimpleRoutingIT.java @@ -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)); } @@ -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]")); } } @@ -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"); diff --git a/server/src/internalClusterTest/java/org/opensearch/update/UpdateIT.java b/server/src/internalClusterTest/java/org/opensearch/update/UpdateIT.java index 67a3519ae1ab9..78fe10e292515 100644 --- a/server/src/internalClusterTest/java/org/opensearch/update/UpdateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/update/UpdateIT.java @@ -578,7 +578,6 @@ public void testContextVariables() throws Exception { GetResponse getResponse = client().prepareGet("test", "id1").setRouting("routing1").execute().actionGet(); Map updateContext = (Map) 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")); diff --git a/test/framework/src/main/java/org/opensearch/test/hamcrest/OpenSearchAssertions.java b/test/framework/src/main/java/org/opensearch/test/hamcrest/OpenSearchAssertions.java index f5f5d5aad1640..68009a7494ba3 100644 --- a/test/framework/src/main/java/org/opensearch/test/hamcrest/OpenSearchAssertions.java +++ b/test/framework/src/main/java/org/opensearch/test/hamcrest/OpenSearchAssertions.java @@ -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)); }