From 50241717d323499b5b8709b798fb3550a8828851 Mon Sep 17 00:00:00 2001 From: Alexander Reelsen Date: Tue, 2 May 2017 14:02:54 +0200 Subject: [PATCH] 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@2888fb0e93de8837b6dba32ccc79db96063b9051 --- .../watcher_mustache/25_array_compare.yaml | 106 ++++++++---------- 1 file changed, 46 insertions(+), 60 deletions(-) diff --git a/qa/smoke-test-watcher-with-mustache/src/test/resources/rest-api-spec/test/watcher_mustache/25_array_compare.yaml b/qa/smoke-test-watcher-with-mustache/src/test/resources/rest-api-spec/test/watcher_mustache/25_array_compare.yaml index a519ee28e7b..cb5e6d6b1f9 100644 --- a/qa/smoke-test-watcher-with-mustache/src/test/resources/rest-api-spec/test/watcher_mustache/25_array_compare.yaml +++ b/qa/smoke-test-watcher-with-mustache/src/test/resources/rest-api-spec/test/watcher_mustache/25_array_compare.yaml @@ -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 }