Skip to content

Commit 8d5074f

Browse files
committed
Replace plugin-level setting strings with private test-specific ones
Signed-off-by: Yuanchun Shen <yuanchu@amazon.com>
1 parent d04b9ff commit 8d5074f

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

common/src/main/java/org/opensearch/sql/common/setting/Settings.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ public enum Key {
6161
SESSION_INACTIVITY_TIMEOUT_MILLIS(
6262
"plugins.query.executionengine.spark.session_inactivity_timeout_millis"),
6363

64-
SCRIPT_DISABLE_MAX_COMPILATIONS_RATE("script.disable_max_compilations_rate"),
65-
SCRIPT_CONTEXT_MAX_COMPILATIONS_RATE_PATTERN("script.context.*.max_compilations_rate"),
66-
6764
/** Async query Settings * */
6865
ASYNC_QUERY_ENABLED("plugins.query.executionengine.async_query.enabled"),
6966
ASYNC_QUERY_EXTERNAL_SCHEDULER_ENABLED(

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
package org.opensearch.sql.legacy;
77

8-
import static org.opensearch.sql.common.setting.Settings.Key;
98
import static org.opensearch.sql.legacy.TestUtils.getResponseBody;
109
import static org.opensearch.sql.legacy.TestsConstants.PERSISTENT;
1110
import static org.opensearch.sql.legacy.TestsConstants.TRANSIENT;
@@ -49,6 +48,7 @@
4948
import org.opensearch.common.xcontent.XContentFactory;
5049
import org.opensearch.core.rest.RestStatus;
5150
import org.opensearch.core.xcontent.XContentBuilder;
51+
import org.opensearch.script.ScriptService;
5252
import org.opensearch.test.rest.OpenSearchRestTestCase;
5353

5454
/**
@@ -75,7 +75,8 @@ public abstract class OpenSearchSQLRestTestCase extends OpenSearchRestTestCase {
7575
+ " }"
7676
+ "}"
7777
+ "}";
78-
78+
private static final String SCRIPT_CONTEXT_MAX_COMPILATIONS_RATE_PATTERN =
79+
"script.context.*.max_compilations_rate";
7980
private static RestClient remoteClient;
8081

8182
/**
@@ -152,7 +153,7 @@ public RestClient initClient(String clusterName) throws IOException {
152153
builder.put(CLIENT_PATH_PREFIX, System.getProperty("tests.rest.client_path_prefix"));
153154
}
154155
// Disable max compilations rate to avoid hitting compilations threshold during tests
155-
builder.put(Key.SCRIPT_DISABLE_MAX_COMPILATIONS_RATE.getKeyValue(), "true");
156+
builder.put(ScriptService.SCRIPT_DISABLE_MAX_COMPILATIONS_RATE_SETTING.getKey(), "true");
156157
return buildClient(builder.build(), hosts.toArray(new HttpHost[0]));
157158
}
158159

@@ -333,17 +334,12 @@ protected void increaseMaxCompilationsRate() throws IOException {
333334
// set
334335
if (!Objects.equals(
335336
getClusterSetting(
336-
org.opensearch.sql.common.setting.Settings.Key.SCRIPT_DISABLE_MAX_COMPILATIONS_RATE
337-
.getKeyValue(),
338-
"persistent"),
337+
ScriptService.SCRIPT_DISABLE_MAX_COMPILATIONS_RATE_SETTING.getKey(), "persistent"),
339338
"true")) {
340339
List<String> contexts = getScriptContexts();
341340
for (String context : contexts) {
342341
String contextCompilationsRate =
343-
org.opensearch.sql.common.setting.Settings.Key
344-
.SCRIPT_CONTEXT_MAX_COMPILATIONS_RATE_PATTERN
345-
.getKeyValue()
346-
.replace("*", context);
342+
SCRIPT_CONTEXT_MAX_COMPILATIONS_RATE_PATTERN.replace("*", context);
347343
updateClusterSetting(contextCompilationsRate, "unlimited", true);
348344
}
349345
}

0 commit comments

Comments
 (0)