Tests: Use execute watch API instead of persisting watch

To speed up the test and ensure no other failures occur,
simply use the execute watch API instead of persisting the watch
and executing then.

relates elastic/x-pack-elasticsearch#1350

Original commit: elastic/x-pack-elasticsearch@2888fb0e93
This commit is contained in:
Alexander Reelsen 2017-05-02 14:02:54 +02:00
parent 9e14141a8e
commit 50241717d3
1 changed files with 46 additions and 60 deletions

View File

@ -5,61 +5,6 @@
cluster.health:
wait_for_status: yellow
- do:
xpack.watcher.stats: {}
- match: { "stats.0.watcher_state": "started" }
- match: { "stats.0.watch_count": 0 }
- do:
xpack.watcher.put_watch:
id: "array-compare-watch"
body: >
{
"trigger": {
"schedule": {
"interval": "5m"
}
},
"input": {
"search": {
"request": {
"indices": [ "test_1" ],
"body": {
"aggs": {
"top_levels": {
"terms": {
"field": "level",
"size": 1
}
}
}
}
}
}
},
"condition": {
"array_compare": {
"ctx.payload.aggregations.top_levels.buckets": {
"path": "doc_count",
"gte": {
"value": 3,
"quantifier": "some"
}
}
}
},
"actions": {
"log": {
"logging": {
"text": "executed at {{ctx.execution_time}}"
}
}
}
}
- match: { _id: "array-compare-watch" }
- match: { created: true }
- do:
index:
index: test_1
@ -90,13 +35,54 @@
- do:
indices.refresh: {}
- do:
xpack.watcher.stats: {}
- match: { "stats.0.watch_count": 1 }
- do:
xpack.watcher.execute_watch:
id: "array-compare-watch"
body: >
{
"watch" : {
"trigger": {
"schedule": {
"interval": "5m"
}
},
"input": {
"search": {
"request": {
"indices": [ "test_1" ],
"body": {
"aggs": {
"top_levels": {
"terms": {
"field": "level",
"size": 1
}
}
}
}
}
}
},
"condition": {
"array_compare": {
"ctx.payload.aggregations.top_levels.buckets": {
"path": "doc_count",
"gte": {
"value": 3,
"quantifier": "some"
}
}
}
},
"actions": {
"log": {
"logging": {
"text": "executed at {{ctx.execution_time}}"
}
}
}
}
}
- match: { "watch_record.result.input.status": "success" }
- match: { "watch_record.result.input.payload.hits.total": 4 }