Skip to content

Commit

Permalink
Fixes ScriptServiceTests.testDefaultBehaviourFineGrainedSettings due to
Browse files Browse the repository at this point in the history
an error with the fine grained settings deprecation.
  • Loading branch information
jdconrad committed May 10, 2017
1 parent 488536d commit 0fe6450
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,19 +219,26 @@ public void testInlineScriptCompiledOnceCache() throws IOException {
public void testDefaultBehaviourFineGrainedSettings() throws IOException {
Settings.Builder builder = Settings.builder();
//rarely inject the default settings, which have no effect
boolean deprecate = false;
if (rarely()) {
builder.put("script.file", "true");
deprecate = true;
}
buildScriptService(builder.build());
createFileScripts("groovy", "mustache", "dtest");
createFileScripts("dtest");

for (ScriptContext scriptContext : scriptContexts) {
// only file scripts are accepted by default
assertCompileRejected("dtest", "script", ScriptType.INLINE, scriptContext);
assertCompileRejected("dtest", "script", ScriptType.STORED, scriptContext);
assertCompileAccepted("dtest", "file_script", ScriptType.FILE, scriptContext);
}
assertWarnings("File scripts are deprecated. Use stored or inline scripts instead.");
if (deprecate) {
assertSettingDeprecationsAndWarnings(ScriptSettingsTests.buildDeprecatedSettingsArray(scriptSettings, "script.file"),
"File scripts are deprecated. Use stored or inline scripts instead.");
} else {
assertWarnings("File scripts are deprecated. Use stored or inline scripts instead.");
}
}

public void testFineGrainedSettings() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import static org.hamcrest.Matchers.equalTo;

public class ScriptSettingsTests extends ESTestCase {

public static Setting<?>[] buildDeprecatedSettingsArray(ScriptSettings scriptSettings, String... keys) {
return buildDeprecatedSettingsArray(null, scriptSettings, keys);
}
Expand Down

0 comments on commit 0fe6450

Please sign in to comment.