Skip to content

Commit

Permalink
Fixed 2.16 integ test failures (#2871) (#2874)
Browse files Browse the repository at this point in the history
Signed-off-by: Vamsi Manohar <reddyvam@amazon.com>
(cherry picked from commit 103c416)
  • Loading branch information
vamsi-amazon committed Jul 31, 2024
1 parent e2683fe commit 0e07bec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public void testDataSourceCreationWithDefaultSettings() {
assertDataSourceCount(1);
assertSelectFromDataSourceReturnsSuccess();
assertSelectFromDummyIndexInValidDataSourceDataSourceReturnsDoesNotExist();
deleteSelfDataSourceCreated();
}

@Test
Expand All @@ -52,6 +53,8 @@ public void testAfterPreviousEnable() {
assertDataSourceCount(0);
assertSelectFromDataSourceReturnsDoesNotExist();
assertAsyncQueryApiDisabled();
setDataSourcesEnabled("transient", true);
deleteSelfDataSourceCreated();
}

@SneakyThrows
Expand Down Expand Up @@ -142,4 +145,11 @@ private Response performRequest(Request request) {
return e.getResponse();
}
}

@SneakyThrows
private void deleteSelfDataSourceCreated() {
Request deleteRequest = getDeleteDataSourceRequest("self");
Response deleteResponse = client().performRequest(deleteRequest);
Assert.assertEquals(204, deleteResponse.getStatusLine().getStatusCode());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ protected static void wipeAllOpenSearchIndices(RestClient client) throws IOExcep
String indexName = jsonObject.getString("index");
try {
// System index, mostly named .opensearch-xxx or .opendistro-xxx, are not allowed to delete
if (!indexName.startsWith(".opensearch") && !indexName.startsWith(".opendistro")) {
if (!indexName.startsWith(".opensearch")
&& !indexName.startsWith(".opendistro")
&& !indexName.startsWith(".ql")) {
client.performRequest(new Request("DELETE", "/" + indexName));
}
} catch (Exception e) {
Expand Down

0 comments on commit 0e07bec

Please sign in to comment.