Skip to content

Commit 1b17520

Browse files
authoredJul 31, 2024··
Fixed integ test delete myindex issue and wipe All indices with security enabled domain (#2878)
Signed-off-by: Vamsi Manohar <reddyvam@amazon.com>
1 parent 53bfeba commit 1b17520

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed
 

‎integ-test/src/test/java/org/opensearch/sql/datasource/DataSourceEnabledIT.java

+13-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77

88
import static org.opensearch.sql.legacy.TestUtils.getResponseBody;
99

10+
import java.io.IOException;
1011
import lombok.SneakyThrows;
1112
import org.json.JSONObject;
13+
import org.junit.After;
1214
import org.junit.Assert;
1315
import org.junit.Test;
1416
import org.opensearch.client.Request;
@@ -18,9 +20,9 @@
1820

1921
public class DataSourceEnabledIT extends PPLIntegTestCase {
2022

21-
@Override
22-
protected boolean preserveClusterUponCompletion() {
23-
return false;
23+
@After
24+
public void cleanUp() throws IOException {
25+
wipeAllClusterSettings();
2426
}
2527

2628
@Test
@@ -39,6 +41,7 @@ public void testDataSourceCreationWithDefaultSettings() {
3941
assertSelectFromDataSourceReturnsSuccess();
4042
assertSelectFromDummyIndexInValidDataSourceDataSourceReturnsDoesNotExist();
4143
deleteSelfDataSourceCreated();
44+
deleteIndex();
4245
}
4346

4447
@Test
@@ -55,6 +58,7 @@ public void testAfterPreviousEnable() {
5558
assertAsyncQueryApiDisabled();
5659
setDataSourcesEnabled("transient", true);
5760
deleteSelfDataSourceCreated();
61+
deleteIndex();
5862
}
5963

6064
@SneakyThrows
@@ -98,6 +102,12 @@ private void createIndex() {
98102
Assert.assertEquals(200, response.getStatusLine().getStatusCode());
99103
}
100104

105+
private void deleteIndex() {
106+
Request request = new Request("DELETE", "/myindex");
107+
Response response = performRequest(request);
108+
Assert.assertEquals(200, response.getStatusLine().getStatusCode());
109+
}
110+
101111
private void createOpenSearchDataSource() {
102112
Request request = new Request("POST", "/_plugins/_query/_datasources");
103113
request.setJsonEntity(

0 commit comments

Comments
 (0)
Please sign in to comment.