mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-26 14:54:56 +00:00
Added rest tests for language plugins
This commit is contained in:
parent
7aac4d5417
commit
956123157b
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- You can add any specific project property here -->
|
<!-- You can add any specific project property here -->
|
||||||
|
<tests.rest.suite>lang_javascript</tests.rest.suite>
|
||||||
|
<tests.rest.load_packaged>false</tests.rest.load_packaged>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
# Integration tests for Lang JavaScript components
|
||||||
|
#
|
||||||
|
setup:
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { "foo": "aaa" }
|
||||||
|
- do:
|
||||||
|
indices.refresh: {}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
"Lang JavaScript":
|
||||||
|
- do:
|
||||||
|
search:
|
||||||
|
body:
|
||||||
|
script_fields:
|
||||||
|
bar:
|
||||||
|
lang: javascript
|
||||||
|
script: "doc['foo'].value + x"
|
||||||
|
params:
|
||||||
|
x: "bbb"
|
||||||
|
|
||||||
|
- match: { hits.hits.0.fields.bar.0: "aaabbb"}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.script.javascript;
|
||||||
|
|
||||||
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
|
import org.elasticsearch.test.rest.ElasticsearchRestTestCase;
|
||||||
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class LangJavaScriptRestIT extends ElasticsearchRestTestCase {
|
||||||
|
|
||||||
|
public LangJavaScriptRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
|
super(testCandidate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ParametersFactory
|
||||||
|
public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
|
||||||
|
return ElasticsearchRestTestCase.createParameters(0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<!-- You can add any specific project property here -->
|
<!-- You can add any specific project property here -->
|
||||||
|
<tests.rest.suite>lang_python</tests.rest.suite>
|
||||||
|
<tests.rest.load_packaged>false</tests.rest.load_packaged>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
# Integration tests for Lang Python components
|
||||||
|
#
|
||||||
|
setup:
|
||||||
|
- do:
|
||||||
|
index:
|
||||||
|
index: test
|
||||||
|
type: test
|
||||||
|
id: 1
|
||||||
|
body: { "foo": "aaa" }
|
||||||
|
- do:
|
||||||
|
indices.refresh: {}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
"Lang Python":
|
||||||
|
- do:
|
||||||
|
search:
|
||||||
|
body:
|
||||||
|
script_fields:
|
||||||
|
bar:
|
||||||
|
lang: python
|
||||||
|
script: "doc['foo'].value + x"
|
||||||
|
params:
|
||||||
|
x: "bbb"
|
||||||
|
|
||||||
|
- match: { hits.hits.0.fields.bar.0: "aaabbb"}
|
@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.elasticsearch.script.python;
|
||||||
|
|
||||||
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
|
import org.elasticsearch.test.rest.ElasticsearchRestTestCase;
|
||||||
|
import org.elasticsearch.test.rest.RestTestCandidate;
|
||||||
|
import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class LangPythonScriptRestIT extends ElasticsearchRestTestCase {
|
||||||
|
|
||||||
|
public LangPythonScriptRestIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||||
|
super(testCandidate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ParametersFactory
|
||||||
|
public static Iterable<Object[]> parameters() throws IOException, RestTestParseException {
|
||||||
|
return ElasticsearchRestTestCase.createParameters(0, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -284,6 +284,7 @@
|
|||||||
<include>api/indices.refresh.json</include>
|
<include>api/indices.refresh.json</include>
|
||||||
<include>api/nodes.info.json</include>
|
<include>api/nodes.info.json</include>
|
||||||
<include>api/count.json</include>
|
<include>api/count.json</include>
|
||||||
|
<include>api/search.json</include>
|
||||||
</includes>
|
</includes>
|
||||||
</testResource>
|
</testResource>
|
||||||
<!-- shared test resources like log4j.properties -->
|
<!-- shared test resources like log4j.properties -->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user