From cccc8867b9619fd9c0824f57096026b2d0c08a2d Mon Sep 17 00:00:00 2001 From: Clinton Gormley Date: Wed, 16 Jul 2014 17:30:18 +0200 Subject: [PATCH] REST: Fixed indexed script/template tests The clients don't have access to the error message for matching purposes. Rewritten tests to work with the clients --- rest-api-spec/test/script/10_basic.yaml | 16 ++++++++++++++-- rest-api-spec/test/template/10_basic.yaml | 7 ++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/rest-api-spec/test/script/10_basic.yaml b/rest-api-spec/test/script/10_basic.yaml index 110ee8e20a3..d576834d647 100644 --- a/rest-api-spec/test/script/10_basic.yaml +++ b/rest-api-spec/test/script/10_basic.yaml @@ -28,14 +28,26 @@ id: "1" lang: "groovy" body: { "script": "_score * foo bar + doc[\"myParent.weight\"].value" } - - match: { "error": /ElasticsearchIllegalArgumentException\SUnable\sto\sparse.*/ } + - do: + catch: /ElasticsearchIllegalArgumentException.Unable.to.parse.*/ + put_script: + id: "1" + lang: "groovy" + body: { "script": "_score * foo bar + doc[\"myParent.weight\"].value" } + - do: catch: request put_script: id: "1" lang: "foobar" body: { "script" : "_score * doc[\"myParent.weight\"].value" } - - match: { "error": /ElasticsearchIllegalArgumentException\Sscript_lang\snot\ssupported/ } + + - do: + catch: /ElasticsearchIllegalArgumentException.script_lang.not.supported/ + put_script: + id: "1" + lang: "foobar" + body: { "script" : "_score * doc[\"myParent.weight\"].value" } diff --git a/rest-api-spec/test/template/10_basic.yaml b/rest-api-spec/test/template/10_basic.yaml index 867f2b11a81..30a4db5d28d 100644 --- a/rest-api-spec/test/template/10_basic.yaml +++ b/rest-api-spec/test/template/10_basic.yaml @@ -25,4 +25,9 @@ put_template: id: "1" body: { "template": { "query": { "match{{}}_all": {}}, "size": "{{my_size}}" } } - - match: { "error": /ElasticsearchIllegalArgumentException\SUnable\sto\sparse.*/ } + + - do: + catch: /ElasticsearchIllegalArgumentException\SUnable\sto\sparse.*/ + put_template: + id: "1" + body: { "template": { "query": { "match{{}}_all": {}}, "size": "{{my_size}}" } }