From 62d3c19db548c358505fd8ce89055e957f0bff54 Mon Sep 17 00:00:00 2001 From: Tanguy Leroux Date: Mon, 1 Aug 2016 18:13:43 +0200 Subject: [PATCH] [TEST] Make MockMustacheScriptEngine less strict Since elastic/elasticsearch#19621 MockScriptEngine is stricter and expects scripts to be defined before being used in tests. Because watcher makes heavy use of scripts without really need of custom logic, this commit changed the MockMustacheScriptEngine implementation so that it always returns the script's source as a result. Original commit: elastic/x-pack-elasticsearch@09cffa9517acd95d1050ae6b9e18d4794e266de6 --- .../org/elasticsearch/script/MockMustacheScriptEngine.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java index 0fe5e1b6fa6..85a2d9db356 100644 --- a/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java +++ b/elasticsearch/x-pack/watcher/src/test/java/org/elasticsearch/script/MockMustacheScriptEngine.java @@ -48,8 +48,8 @@ public class MockMustacheScriptEngine extends MockScriptEngine { if (script.contains("{{") && script.contains("}}")) { throw new IllegalArgumentException("Fix your test to not rely on mustache"); } - - return super.compile(name, script, params); + // We always return the script's source as it is + return new MockCompiledScript(name, params, script, null); } @Override