Skip to content

Commit

Permalink
Fixed 2.16 integ test failures (#2871) (#2875)
Browse files Browse the repository at this point in the history
Signed-off-by: Vamsi Manohar <[email protected]>
(cherry picked from commit 103c416)
  • Loading branch information
vmmusings authored Jul 31, 2024
1 parent ec61853 commit 3360d8f
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 3360d8f

Please sign in to comment.