mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-22 12:56:53 +00:00
Port reindex's script tests to painless
All but the timeout ones work. Those are skipped for now.
This commit is contained in:
parent
30b8a51eb9
commit
4c15d143d9
@ -18,9 +18,3 @@
|
||||
*/
|
||||
|
||||
apply plugin: 'elasticsearch.rest-test'
|
||||
|
||||
integTest {
|
||||
cluster {
|
||||
setting 'script.inline', 'true'
|
||||
}
|
||||
}
|
@ -27,8 +27,8 @@ import org.elasticsearch.test.rest.parser.RestTestParseException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class SmokeTestReindexWithGroovyIT extends ESRestTestCase {
|
||||
public SmokeTestReindexWithGroovyIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||
public class SmokeTestReindexWithPainlessIT extends ESRestTestCase {
|
||||
public SmokeTestReindexWithPainlessIT(@Name("yaml") RestTestCandidate testCandidate) {
|
||||
super(testCandidate);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
dest:
|
||||
index: new_twitter
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx._source.user = "other" + ctx._source.user
|
||||
- match: {created: 1}
|
||||
- match: {noops: 0}
|
||||
@ -57,6 +58,7 @@
|
||||
dest:
|
||||
index: new_twitter
|
||||
script:
|
||||
lang: painless
|
||||
inline: if (ctx._id == "1") {ctx._source.user = "other" + ctx._source.user}
|
||||
- match: {created: 2}
|
||||
- match: {noops: 0}
|
||||
@ -116,6 +118,7 @@
|
||||
dest:
|
||||
index: new_twitter
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx._parent = ctx._source.user
|
||||
- match: {created: 1}
|
||||
- match: {noops: 0}
|
||||
@ -159,6 +162,7 @@
|
||||
dest:
|
||||
index: new_twitter
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx._routing = ctx._source.user
|
||||
- match: {created: 2}
|
||||
- match: {noops: 0}
|
||||
@ -217,6 +221,7 @@
|
||||
dest:
|
||||
index: new_twitter
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx._parent = ctx._source.user; ctx._routing = "cat"
|
||||
- match: {created: 1}
|
||||
- match: {noops: 0}
|
||||
@ -262,6 +267,7 @@
|
||||
dest:
|
||||
index: new_twitter
|
||||
script:
|
||||
lang: painless
|
||||
inline: if (ctx._source.user == "kimchy") {ctx._source.user = "not" + ctx._source.user} else {ctx.op = "noop"}
|
||||
- match: {created: 1}
|
||||
- match: {noops: 1}
|
||||
@ -314,6 +320,7 @@
|
||||
dest:
|
||||
index: new_twitter
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx.op = "noop"
|
||||
- match: {updated: 0}
|
||||
- match: {noops: 2}
|
||||
@ -354,6 +361,7 @@
|
||||
index: new_twitter
|
||||
version_type: external
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx._source.user = "other" + ctx._source.user; ctx._version = null
|
||||
- match: {updated: 1}
|
||||
- match: {noops: 0}
|
||||
@ -393,6 +401,7 @@
|
||||
dest:
|
||||
index: new_twitter
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx._source.user = "other" + ctx._source.user; ctx._id = null
|
||||
- match: {created: 1}
|
||||
- match: {noops: 0}
|
||||
@ -432,6 +441,7 @@
|
||||
dest:
|
||||
index: new_twitter
|
||||
script:
|
||||
lang: painless
|
||||
inline: if (ctx._source.user == "kimchy") {ctx._index = 'other_new_twitter'}
|
||||
- match: {created: 2}
|
||||
- match: {noops: 0}
|
||||
@ -504,6 +514,7 @@
|
||||
index: index2
|
||||
type: type2
|
||||
script:
|
||||
lang: painless
|
||||
inline: "ctx._id = ctx._source.lang + '_' + ctx._source.id;
|
||||
if (ctx._source.lang != \"en\" ) {ctx.op = 'delete'}"
|
||||
- match: {created: 1}
|
@ -19,5 +19,6 @@
|
||||
dest:
|
||||
index: new_twitter
|
||||
script:
|
||||
lang: painless
|
||||
inline: syntax errors are fun!
|
||||
- match: {error.reason: 'Failed to compile inline script [syntax errors are fun!] using lang [groovy]'}
|
||||
- match: {error.reason: 'compile error'}
|
@ -1,5 +1,8 @@
|
||||
---
|
||||
"Timeout":
|
||||
- skip:
|
||||
version: "all"
|
||||
reason: painless doesn't support thread.sleep so we need to come up with a better way
|
||||
- do:
|
||||
index:
|
||||
index: twitter
|
||||
@ -19,9 +22,10 @@
|
||||
timeout: 10
|
||||
query:
|
||||
script:
|
||||
lang: painless
|
||||
# Sleep 100x longer than the timeout. That should cause a timeout!
|
||||
# Return true causes the document to try to be collected which is what actually triggers the timeout.
|
||||
script: sleep(1000); return true
|
||||
script: java.lang.Thread.sleep(1000); return true
|
||||
dest:
|
||||
index: new_twitter
|
||||
- is_true: timed_out
|
@ -17,7 +17,8 @@
|
||||
index: source
|
||||
query:
|
||||
script:
|
||||
script: 1/0 # Divide by 0 to cause a search time exception
|
||||
lang: painless
|
||||
script: throw new IllegalArgumentException("Cats!")
|
||||
dest:
|
||||
index: dest
|
||||
- match: {created: 0}
|
||||
@ -27,8 +28,8 @@
|
||||
- is_true: failures.0.shard
|
||||
- match: {failures.0.index: source}
|
||||
- is_true: failures.0.node
|
||||
- match: {failures.0.reason.type: general_script_exception}
|
||||
- match: {failures.0.reason.reason: "failed to run inline script [1/0] using lang [groovy]"}
|
||||
- match: {failures.0.reason.caused_by.type: arithmetic_exception}
|
||||
- match: {failures.0.reason.caused_by.reason: Division by zero}
|
||||
- match: {failures.0.reason.type: script_exception}
|
||||
- match: {failures.0.reason.reason: runtime error}
|
||||
- match: {failures.0.reason.caused_by.type: illegal_argument_exception}
|
||||
- match: {failures.0.reason.caused_by.reason: Cats!}
|
||||
- gte: { took: 0 }
|
@ -15,6 +15,7 @@
|
||||
refresh: true
|
||||
body:
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx._source.user = "not" + ctx._source.user
|
||||
- match: {updated: 1}
|
||||
- match: {noops: 0}
|
||||
@ -51,6 +52,7 @@
|
||||
index: twitter
|
||||
body:
|
||||
script:
|
||||
lang: painless
|
||||
inline: if (ctx._source.user == "kimchy") {ctx._source.user = "not" + ctx._source.user} else {ctx.op = "noop"}
|
||||
- match: {updated: 1}
|
||||
- match: {noops: 1}
|
||||
@ -96,6 +98,7 @@
|
||||
index: twitter
|
||||
body:
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx.op = "noop"
|
||||
- match: {updated: 0}
|
||||
- match: {noops: 2}
|
||||
@ -118,6 +121,7 @@
|
||||
index: twitter
|
||||
body:
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx.junk = "stuff"
|
||||
|
||||
---
|
||||
@ -137,6 +141,7 @@
|
||||
index: twitter
|
||||
body:
|
||||
script:
|
||||
lang: painless
|
||||
inline: ctx._id = "stuff"
|
||||
|
||||
---
|
||||
@ -174,6 +179,7 @@
|
||||
index: twitter
|
||||
body:
|
||||
script:
|
||||
lang: painless
|
||||
inline: if (ctx._source.level != 11) {ctx._source.last_updated = "2016-01-02T00:00:00Z"} else {ctx.op = "delete"}
|
||||
- match: {updated: 3}
|
||||
- match: {deleted: 1}
|
||||
@ -237,17 +243,16 @@
|
||||
index: twitter
|
||||
body:
|
||||
script:
|
||||
inline: "switch (ctx._source.level % 3) {
|
||||
case 0:
|
||||
ctx._source.last_updated = \"2016-01-02T00:00:00Z\";
|
||||
break;
|
||||
case 1:
|
||||
ctx.op = \"noop\";
|
||||
break;
|
||||
case 2:
|
||||
ctx.op = \"delete\";
|
||||
break;
|
||||
}"
|
||||
lang: painless
|
||||
inline: |
|
||||
int choice = ctx._source.level % 3;
|
||||
if (choice == 0) {
|
||||
ctx._source.last_updated = "2016-01-02T00:00:00Z";
|
||||
} else if (choice == 1) {
|
||||
ctx.op = "noop";
|
||||
} else {
|
||||
ctx.op = "delete";
|
||||
}
|
||||
- match: {updated: 2}
|
||||
- match: {deleted: 1}
|
||||
- match: {noops: 1}
|
||||
@ -303,6 +308,7 @@
|
||||
index: twitter
|
||||
body:
|
||||
script:
|
||||
lang: painless
|
||||
inline: if (ctx._source.user == "kimchy") {ctx.op = "update"} else {ctx.op = "junk"}
|
||||
|
||||
- match: { error.reason: 'Operation type [junk] not allowed, only [noop, index, delete] are allowed' }
|
@ -16,5 +16,6 @@
|
||||
refresh: true
|
||||
body:
|
||||
script:
|
||||
lang: painless
|
||||
inline: syntax errors are fun!
|
||||
- match: {error.reason: 'Failed to compile inline script [syntax errors are fun!] using lang [groovy]'}
|
||||
- match: {error.reason: 'compile error'}
|
@ -1,5 +1,8 @@
|
||||
---
|
||||
"Timeout":
|
||||
- skip:
|
||||
version: "all"
|
||||
reason: painless doesn't support thread.sleep so we need to come up with a better way
|
||||
- do:
|
||||
index:
|
||||
index: twitter
|
||||
@ -18,9 +21,10 @@
|
||||
body:
|
||||
query:
|
||||
script:
|
||||
lang: painless
|
||||
# Sleep 100x longer than the timeout. That should cause a timeout!
|
||||
# Return true causes the document to try to be collected which is what actually triggers the timeout.
|
||||
script: sleep(1000); return true
|
||||
script: java.lang.Thread.sleep(1000); return true
|
||||
- is_true: timed_out
|
||||
- match: {updated: 0}
|
||||
- match: {noops: 0}
|
@ -16,15 +16,16 @@
|
||||
body:
|
||||
query:
|
||||
script:
|
||||
script: 1/0 # Divide by 0 to cause a search time exception
|
||||
lang: painless
|
||||
script: throw new IllegalArgumentException("Cats!")
|
||||
- match: {updated: 0}
|
||||
- match: {version_conflicts: 0}
|
||||
- match: {batches: 0}
|
||||
- is_true: failures.0.shard
|
||||
- match: {failures.0.index: source}
|
||||
- is_true: failures.0.node
|
||||
- match: {failures.0.reason.type: general_script_exception}
|
||||
- match: {failures.0.reason.reason: "failed to run inline script [1/0] using lang [groovy]"}
|
||||
- match: {failures.0.reason.caused_by.type: arithmetic_exception}
|
||||
- match: {failures.0.reason.caused_by.reason: Division by zero}
|
||||
- match: {failures.0.reason.type: script_exception}
|
||||
- match: {failures.0.reason.reason: runtime error}
|
||||
- match: {failures.0.reason.caused_by.type: illegal_argument_exception}
|
||||
- match: {failures.0.reason.caused_by.reason: Cats!}
|
||||
- gte: { took: 0 }
|
@ -46,11 +46,11 @@ List projects = [
|
||||
'qa:backwards-5.0',
|
||||
'qa:evil-tests',
|
||||
'qa:smoke-test-client',
|
||||
'qa:smoke-test-multinode',
|
||||
'qa:smoke-test-reindex-with-groovy',
|
||||
'qa:smoke-test-plugins',
|
||||
'qa:smoke-test-ingest-with-all-dependencies',
|
||||
'qa:smoke-test-ingest-disabled',
|
||||
'qa:smoke-test-multinode',
|
||||
'qa:smoke-test-plugins',
|
||||
'qa:smoke-test-reindex-with-painless',
|
||||
'qa:vagrant',
|
||||
]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user