Skip to content

Commit

Permalink
Fixed integ test delete myindex issue and wipe All indices with secur…
Browse files Browse the repository at this point in the history
…ity enabled domain (#2878) (#2881)

(cherry picked from commit 1b17520)

Signed-off-by: Vamsi Manohar <reddyvam@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 3360d8f commit 0848bf0
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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.After;
import org.junit.Assert;
import org.junit.Test;
import org.opensearch.client.Request;
Expand All @@ -18,9 +20,9 @@

public class DataSourceEnabledIT extends PPLIntegTestCase {

@Override
protected boolean preserveClusterUponCompletion() {
return false;
@After
public void cleanUp() throws IOException {
wipeAllClusterSettings();
}

@Test
Expand All @@ -39,6 +41,7 @@ public void testDataSourceCreationWithDefaultSettings() {
assertSelectFromDataSourceReturnsSuccess();
assertSelectFromDummyIndexInValidDataSourceDataSourceReturnsDoesNotExist();
deleteSelfDataSourceCreated();
deleteIndex();
}

@Test
Expand All @@ -55,6 +58,7 @@ public void testAfterPreviousEnable() {
assertAsyncQueryApiDisabled();
setDataSourcesEnabled("transient", true);
deleteSelfDataSourceCreated();
deleteIndex();
}

@SneakyThrows
Expand Down Expand Up @@ -98,6 +102,12 @@ private void createIndex() {
Assert.assertEquals(200, response.getStatusLine().getStatusCode());
}

private void deleteIndex() {
Request request = new Request("DELETE", "/myindex");
Response response = performRequest(request);
Assert.assertEquals(200, response.getStatusLine().getStatusCode());
}

private void createOpenSearchDataSource() {
Request request = new Request("POST", "/_plugins/_query/_datasources");
request.setJsonEntity(
Expand Down

0 comments on commit 0848bf0

Please sign in to comment.