Watcher: Added teardown sections to the REST tests

The tests have been failing because they haven't cleaned up the environment
after their run, leaving documents with watches behind.

This patch adds `teardown` sections which delete the documents
created by tests.

Related: elastic/elasticsearch#2648

Closes elastic/elasticsearch#2690

Original commit: elastic/x-pack-elasticsearch@e34e40d879
This commit is contained in:
Karel Minarik 2016-07-01 20:13:21 +02:00
parent ec3b11d802
commit 427563132e
5 changed files with 53 additions and 9 deletions

View File

@ -1,9 +1,18 @@
--- ---
"Test get watch api": setup:
- do: - do:
cluster.health: cluster.health:
wait_for_status: yellow wait_for_status: yellow
---
teardown:
- do:
xpack.watcher.delete_watch:
id: "my_watch"
ignore: 404
---
"Test get watch api":
- do: - do:
xpack.watcher.put_watch: xpack.watcher.put_watch:
id: "my_watch" id: "my_watch"

View File

@ -1,10 +1,18 @@
--- ---
"Getting started - Monitor cluster health": setup:
- do: - do:
cluster.health: cluster.health:
wait_for_status: yellow wait_for_status: yellow
---
teardown:
- do:
xpack.watcher.delete_watch:
id: "cluster_health_watch"
ignore: 404
---
"Getting started - Monitor cluster health":
- do: - do:
xpack.watcher.stats: {} xpack.watcher.stats: {}
- match: { "watcher_state": "started" } - match: { "watcher_state": "started" }

View File

@ -1,9 +1,18 @@
--- ---
"Test put watch api with watch level throttle": setup:
- do: - do:
cluster.health: cluster.health:
wait_for_status: yellow wait_for_status: yellow
---
teardown:
- do:
xpack.watcher.delete_watch:
id: "my_watch1"
ignore: 404
---
"Test put watch api with watch level throttle":
- do: - do:
xpack.watcher.put_watch: xpack.watcher.put_watch:
id: "my_watch1" id: "my_watch1"

View File

@ -1,9 +1,18 @@
--- ---
"Test put watch api with action level throttle period": setup:
- do: - do:
cluster.health: cluster.health:
wait_for_status: yellow wait_for_status: yellow
---
teardown:
- do:
xpack.watcher.delete_watch:
id: "my_watch1"
ignore: 404
---
"Test put watch api with action level throttle period":
- do: - do:
xpack.watcher.put_watch: xpack.watcher.put_watch:
id: "my_watch1" id: "my_watch1"

View File

@ -1,15 +1,24 @@
--- ---
"Test put inactive watch": setup:
- do: - do:
cluster.health: cluster.health:
wait_for_status: yellow wait_for_status: yellow
---
teardown:
- do:
xpack.watcher.delete_watch:
id: "my_watch"
ignore: 404
---
"Test put inactive watch":
- do: - do:
xpack.watcher.put_watch: xpack.watcher.put_watch:
id: "my_watch" id: "my_watch"
master_timeout: "40s" master_timeout: "40s"
active: false active: false
body: > body: >
{ {
"trigger": { "trigger": {
"schedule": { "schedule": {