Skip to content

Commit

Permalink
Integ test logging
Browse files Browse the repository at this point in the history
Signed-off-by: Vamsi Manohar <[email protected]>
  • Loading branch information
vamsi-amazon committed Mar 21, 2024
1 parent 109af96 commit 724bc97
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import java.util.List;
import java.util.Map;
import lombok.SneakyThrows;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
Expand All @@ -37,22 +39,29 @@

public class DataSourceAPIsIT extends PPLIntegTestCase {

public static final Logger LOGGER = LogManager.getLogger(DataSourceAPIsIT.class);

@Override
protected void init() throws Exception {
LOGGER.error("Before init");
loadIndex(Index.DATASOURCES);
LOGGER.error("After init");
}

@After
public void cleanUp() throws IOException {
LOGGER.error("Before cleanUp");
wipeAllClusterSettings();
LOGGER.error("After cleanUp");
}

@AfterClass
protected static void deleteDataSourcesCreated() throws IOException {
LOGGER.error("After cleanUp");
Request deleteRequest = getDeleteDataSourceRequest("create_prometheus");
Response deleteResponse = client().performRequest(deleteRequest);
Assert.assertEquals(204, deleteResponse.getStatusLine().getStatusCode());

deleteRequest = getDeleteDataSourceRequest("update_prometheus");
deleteResponse = client().performRequest(deleteRequest);
Assert.assertEquals(204, deleteResponse.getStatusLine().getStatusCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.json.JSONArray;
import org.json.JSONObject;
import org.junit.AfterClass;
Expand All @@ -71,6 +73,8 @@
/** OpenSearch Rest integration test base for SQL testing */
public abstract class SQLIntegTestCase extends OpenSearchSQLRestTestCase {

public static final Logger LOGGER = LogManager.getLogger(SQLIntegTestCase.class);

public static final String PERSISTENT = "persistent";
public static final String TRANSIENT = "transient";
public static final Integer DEFAULT_QUERY_SIZE_LIMIT =
Expand All @@ -84,6 +88,7 @@ public boolean shouldResetQuerySizeLimit() {

@Before
public void setUpIndices() throws Exception {
LOGGER.error("Setting up indices");
if (client() == null) {
initClient();
}
Expand Down Expand Up @@ -147,7 +152,9 @@ public static void dumpCoverage() {
*/
@AfterClass
public static void cleanUpIndices() throws IOException {
LOGGER.error("Cleaning up indices");
if (System.getProperty("tests.rest.bwcsuite") == null) {
LOGGER.error("Cleaning up indices");
wipeAllOpenSearchIndices();
wipeAllClusterSettings();
}
Expand Down

0 comments on commit 724bc97

Please sign in to comment.