From c208d764291a7ff3d5ecec96f30eb8d90c95884d Mon Sep 17 00:00:00 2001 From: Vamsi Manohar Date: Tue, 30 Jul 2024 13:40:48 -0700 Subject: [PATCH] Fixed 2.16 integ test failures Signed-off-by: Vamsi Manohar --- .../opensearch/sql/datasource/DataSourceEnabledIT.java | 9 +++++++++ .../opensearch/sql/legacy/OpenSearchSQLRestTestCase.java | 4 +++- 2 files changed, 12 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..392237eb1d 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 @@ -7,8 +7,10 @@ import static org.opensearch.sql.legacy.TestUtils.getResponseBody; +import java.io.IOException; import lombok.SneakyThrows; import org.json.JSONObject; +import org.junit.AfterClass; import org.junit.Assert; import org.junit.Test; import org.opensearch.client.Request; @@ -23,6 +25,13 @@ protected boolean preserveClusterUponCompletion() { return false; } + @AfterClass + protected static void deleteSelfDataSourceCreated() throws IOException { + Request deleteRequest = getDeleteDataSourceRequest("self"); + Response deleteResponse = client().performRequest(deleteRequest); + Assert.assertEquals(204, deleteResponse.getStatusLine().getStatusCode()); + } + @Test public void testAsyncQueryAPIFailureIfSettingIsDisabled() { setDataSourcesEnabled("transient", false); 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) {