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 (opensearch-project#2878)

Signed-off-by: Vamsi Manohar <reddyvam@amazon.com>
  • Loading branch information
vmmusings authored and manasvinibs committed Aug 14, 2024
1 parent 2f031a5 commit 9bbd136
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 9bbd136

Please sign in to comment.