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
wait_for_status: yellow
- do:
- xpack.watcher.stats: {}
- - match: { "stats.0.watcher_state": "started" }
- - match: { "stats.0.watch_count": 0 }
+ index:
+ index: test_1
+ type: test
+ id: 1
+ body: { level: 0 }
- do:
- xpack.watcher.put_watch:
- id: "array-compare-watch"
+ index:
+ index: test_1
+ type: test
+ id: 2
+ body: { level: 0 }
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 3
+ body: { level: 0 }
+
+ - do:
+ index:
+ index: test_1
+ type: test
+ id: 4
+ body: { level: 1 }
+ - do:
+ indices.refresh: {}
+
+ - do:
+ xpack.watcher.execute_watch:
body: >
{
+ "watch" : {
"trigger": {
"schedule": {
"interval": "5m"
}
}
}
+ }
- - match: { _id: "array-compare-watch" }
- - match: { created: true }
-
- - do:
- index:
- index: test_1
- type: test
- id: 1
- body: { level: 0 }
-
- - do:
- index:
- index: test_1
- type: test
- id: 2
- body: { level: 0 }
-
- - do:
- index:
- index: test_1
- type: test
- id: 3
- body: { level: 0 }
-
- - do:
- index:
- index: test_1
- type: test
- id: 4
- body: { level: 1 }
- - do:
- indices.refresh: {}
-
- - do:
- xpack.watcher.stats: {}
- - match: { "stats.0.watch_count": 1 }
-
- - do:
- xpack.watcher.execute_watch:
- id: "array-compare-watch"
- match: { "watch_record.result.input.status": "success" }
- match: { "watch_record.result.input.payload.hits.total": 4 }
