From 3360d8fe0d90f7065583f60de0eb5361806edf36 Mon Sep 17 00:00:00 2001 From: Vamsi Manohar Date: Tue, 30 Jul 2024 17:30:25 -0700 Subject: [PATCH] Fixed 2.16 integ test failures (#2871) (#2875) Signed-off-by: Vamsi Manohar (cherry picked from commit 103c4160ae2a129284ff5be70bac40951e0c6a18) --- .../opensearch/sql/datasource/DataSourceEnabledIT.java | 10 ++++++++++ .../sql/legacy/OpenSearchSQLRestTestCase.java | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/integ-test/src/test/java/org/opensearch/sql/datasource/DataSourceEnabledIT.java b/integ-test/src/test/java/org/opensearch/sql/datasource/DataSourceEnabledIT.java index 9c522134a4..b0bc87a0c6 100644 --- a/integ-test/src/test/java/org/opensearch/sql/datasource/DataSourceEnabledIT.java +++ b/integ-test/src/test/java/org/opensearch/sql/datasource/DataSourceEnabledIT.java @@ -38,6 +38,7 @@ public void testDataSourceCreationWithDefaultSettings() { assertDataSourceCount(1); assertSelectFromDataSourceReturnsSuccess(); assertSelectFromDummyIndexInValidDataSourceDataSourceReturnsDoesNotExist(); + deleteSelfDataSourceCreated(); } @Test @@ -52,6 +53,8 @@ public void testAfterPreviousEnable() { assertDataSourceCount(0); assertSelectFromDataSourceReturnsDoesNotExist(); assertAsyncQueryApiDisabled(); + setDataSourcesEnabled("transient", true); + deleteSelfDataSourceCreated(); } @SneakyThrows @@ -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()); + } } diff --git a/integ-test/src/test/java/org/opensearch/sql/legacy/OpenSearchSQLRestTestCase.java b/integ-test/src/test/java/org/opensearch/sql/legacy/OpenSearchSQLRestTestCase.java index d4679d7ed5..ce118031e1 100644 --- a/integ-test/src/test/java/org/opensearch/sql/legacy/OpenSearchSQLRestTestCase.java +++ b/integ-test/src/test/java/org/opensearch/sql/legacy/OpenSearchSQLRestTestCase.java @@ -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) {