Brian Murphy 7f0e4fab41 Fix REST execute API call with empty body.
Execute with an empty body will now just use the defaults.
Add REST test for empty body.
Fixes elastic/elasticsearch#217

Original commit: elastic/x-pack-elasticsearch@072cd47250
2015-04-16 15:27:08 -04:00

66 lines
1.8 KiB
YAML

---
"Test execute watch api with empty body":
- do:
cluster.health:
wait_for_status: green
- do:
put_watch:
id: "my_logging_watch"
body: >
{
"trigger" : {
"schedule" : { "cron" : "0 0/1 * * * ?" }
},
"input" : {
"search" : {
"request" : {
"indices" : [ "logstash*" ],
"body" : {
"query" : {
"filtered": {
"query": {
"match": {
"response": 404
}
},
"filter": {
"range": {
"@timestamp" : {
"from": "{{ctx.trigger.scheduled_time}}||-5m",
"to": "{{ctx.trigger.triggered_time}}"
}
}
}
}
}
}
}
}
},
"condition" : {
"script" : {
"script" : "ctx.payload.hits.total > 1"
}
},
"actions" : {
"Logging" : {
"logging" : {
"text" : "foobar"
}
}
}
}
- match: { _id: "my_logging_watch" }
- do:
execute_watch:
id: "my_logging_watch"
body: null
- match: { "watch_id": "my_logging_watch" }
- match: { "watch_execution.condition_result.always_true": {} }
- match: { "state": "executed" }
- match: { "watch_execution.actions_results.Logging.logging.success" : true }
- match: { "watch_execution.actions_results.Logging.logging.logged_text" : "foobar" }