Skip to content

Fixed integ test delete myindex issue and wipe All indices with security plugin. #2878

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading