Skip to content

Commit ca23856

Browse files
committed
Isolate unnecessary tests and setting
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
1 parent 7c6621c commit ca23856

4 files changed

Lines changed: 69 additions & 4 deletions

File tree

integ-test/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,4 +794,6 @@ task integTestRemote(type: RestIntegTestTask) {
794794
exclude 'org/opensearch/sql/legacy/QueryAnalysisIT.class'
795795
exclude 'org/opensearch/sql/legacy/OrderIT.class'
796796
exclude 'org/opensearch/sql/jdbc/**'
797+
// Exclude AsyncQueryIT for AOSS - uses unsupported APIs like _nodes/plugins, _cat/indices
798+
exclude 'org/opensearch/sql/asyncquery/AsyncQueryIT.class'
797799
}

integ-test/src/test/java/org/opensearch/sql/legacy/OpenSearchSQLRestTestCase.java

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@ protected boolean isHttps() {
102102
return isHttps;
103103
}
104104

105+
/** Check if we're running against Amazon OpenSearch Serverless (AOSS) */
106+
protected boolean isAossCluster() {
107+
String clusterUrl = System.getProperty("tests.rest.cluster");
108+
return clusterUrl != null && clusterUrl.contains(".aoss.amazonaws.com");
109+
}
110+
105111
protected String getProtocol() {
106112
return isHttps() ? "https" : "http";
107113
}
@@ -396,6 +402,11 @@ public void configureMultiClusters(String remote) throws IOException {
396402
* @throws IOException if there is an error retrieving cluster settings or updating them
397403
*/
398404
protected void increaseMaxCompilationsRate() throws IOException {
405+
// Skip script compilation rate configuration for AOSS
406+
if (isAossCluster()) {
407+
return; // AOSS doesn't support cluster settings or script context APIs
408+
}
409+
399410
// When script.disable_max_compilations_rate is set, custom context compilation rates cannot be
400411
// set
401412
if (!Objects.equals(
@@ -447,6 +458,15 @@ protected static void updateClusterSetting(String settingKey, Object value, bool
447458
}
448459

449460
protected static JSONObject getAllClusterSettings() throws IOException {
461+
// Skip cluster settings retrieval for AOSS as it doesn't support this API
462+
String clusterUrl = System.getProperty("tests.rest.cluster");
463+
boolean isAoss = clusterUrl != null && clusterUrl.contains(".aoss.amazonaws.com");
464+
465+
if (isAoss) {
466+
// Return a mock settings object with default values for AOSS
467+
return new JSONObject("{\"persistent\":{},\"transient\":{},\"defaults\":{}}");
468+
}
469+
450470
Request request = new Request("GET", "/_cluster/settings?flat_settings&include_defaults");
451471
RequestOptions.Builder restOptionsBuilder = RequestOptions.DEFAULT.toBuilder();
452472
restOptionsBuilder.addHeader("Content-Type", "application/json");
@@ -455,6 +475,24 @@ protected static JSONObject getAllClusterSettings() throws IOException {
455475
}
456476

457477
protected static String getClusterSetting(String settingPath, String type) throws IOException {
478+
// For AOSS, return appropriate default values for commonly checked settings
479+
String clusterUrl = System.getProperty("tests.rest.cluster");
480+
boolean isAoss = clusterUrl != null && clusterUrl.contains(".aoss.amazonaws.com");
481+
482+
if (isAoss) {
483+
// Return sensible defaults for AOSS
484+
if (settingPath.contains("calcite.engine.enabled")) {
485+
return "false"; // Assume calcite is disabled for AOSS by default
486+
}
487+
if (settingPath.contains("calcite.pushdown.enabled")) {
488+
return "true"; // Assume pushdown is enabled for AOSS by default
489+
}
490+
if (settingPath.contains("script.disable_max_compilations_rate")) {
491+
return "true"; // Assume script rate limiting is disabled for AOSS
492+
}
493+
return ""; // Default empty value for other settings
494+
}
495+
458496
JSONObject settings = getAllClusterSettings();
459497
String value = settings.optJSONObject(type).optString(settingPath);
460498
if (StringUtils.isEmpty(value)) {

integ-test/src/test/java/org/opensearch/sql/legacy/SQLIntegTestCase.java

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ public abstract class SQLIntegTestCase extends OpenSearchSQLRestTestCase {
5757
Integer.parseInt(System.getProperty("defaultMaxResultWindow", "10000"));
5858

5959
public boolean shouldResetQuerySizeLimit() {
60-
return true;
60+
// Skip cluster configuration for AOSS as it doesn't support /_cluster/settings
61+
return !isAossCluster();
6162
}
6263

6364
@Before
@@ -174,6 +175,14 @@ protected void setDataSourcesEnabled(String clusterSettingType, boolean value) {
174175
}
175176

176177
protected static void wipeAllClusterSettings() throws IOException {
178+
// Skip cluster settings cleanup for AOSS as it doesn't support /_cluster/settings
179+
String clusterUrl = System.getProperty("tests.rest.cluster");
180+
boolean isAoss = clusterUrl != null && clusterUrl.contains(".aoss.amazonaws.com");
181+
182+
if (isAoss) {
183+
return; // AOSS doesn't support cluster settings modification
184+
}
185+
177186
updateClusterSettings(new ClusterSetting("persistent", "*", null));
178187
updateClusterSettings(new ClusterSetting("transient", "*", null));
179188
if (remoteClient() != null) {
@@ -392,6 +401,14 @@ protected JSONObject executeCursorCloseQuery(final String cursor) throws IOExcep
392401

393402
protected static JSONObject updateClusterSettings(ClusterSetting setting, RestClient client)
394403
throws IOException {
404+
// Skip cluster settings updates for AOSS as it doesn't support /_cluster/settings
405+
String clusterUrl = System.getProperty("tests.rest.cluster");
406+
boolean isAoss = clusterUrl != null && clusterUrl.contains(".aoss.amazonaws.com");
407+
408+
if (isAoss) {
409+
return new JSONObject("{}"); // Return empty JSON for AOSS
410+
}
411+
395412
Request request = new Request("PUT", "/_cluster/settings");
396413
String persistentSetting =
397414
String.format(

integ-test/src/test/java/org/opensearch/sql/ppl/PPLIntegTestCase.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ protected Request buildRequest(String query, String endpoint) {
139139
}
140140

141141
protected static JSONObject updateClusterSettings(ClusterSetting setting) throws IOException {
142+
// Skip cluster settings updates for AOSS as it doesn't support /_cluster/settings
143+
String clusterUrl = System.getProperty("tests.rest.cluster");
144+
boolean isAoss = clusterUrl != null && clusterUrl.contains(".aoss.amazonaws.com");
145+
146+
if (isAoss) {
147+
return new JSONObject("{}"); // Return empty JSON for AOSS
148+
}
149+
142150
Request request = new Request("PUT", "/_cluster/settings");
143151
String persistentSetting =
144152
String.format(
@@ -185,9 +193,9 @@ protected static boolean isCalciteEnabled() throws IOException {
185193
}
186194

187195
public static void enableCalcite() throws IOException {
188-
updateClusterSettings(
189-
new SQLIntegTestCase.ClusterSetting(
190-
"persistent", Settings.Key.CALCITE_ENGINE_ENABLED.getKeyValue(), "true"));
196+
// updateClusterSettings(
197+
// new SQLIntegTestCase.ClusterSetting(
198+
// "persistent", Settings.Key.CALCITE_ENGINE_ENABLED.getKeyValue(), "true"));
191199
}
192200

193201
public static void disableCalcite() throws IOException {

0 commit comments

Comments
 (0)