From 103c4160ae2a129284ff5be70bac40951e0c6a18 Mon Sep 17 00:00:00 2001 From: Vamsi Manohar Date: Tue, 30 Jul 2024 15:20:19 -0700 Subject: [PATCH] Fixed 2.16 integ test failures (#2871) Signed-off-by: Vamsi Manohar --- .../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 d73e3468d4..ced69d54a0 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 @@ -195,7 +195,9 @@ protected static void wipeAllOpenSearchIndices(RestClient client) throws IOExcep 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) {