Use random http port for watcher REST tests (elastic/x-pack-elasticsearch#936)
Adapts the Watcher REST tests so that they don't require a fixed http port anymore. Original commit: elastic/x-pack-elasticsearch@14919b16e7
This commit is contained in:
parent
edb8c543ed
commit
e52fbdf63c
|
@ -10,7 +10,6 @@ integTestCluster {
|
|||
plugin ':x-pack-elasticsearch:plugin'
|
||||
setting 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.monitoring.enabled', 'false'
|
||||
setting 'http.port', '9400'
|
||||
setting 'script.inline', 'true'
|
||||
setting 'script.stored', 'true'
|
||||
// Need to allow more compilations per minute because of the integration tests
|
||||
|
|
|
@ -4,41 +4,51 @@
|
|||
cluster.health:
|
||||
wait_for_status: yellow
|
||||
|
||||
# extract http host and port from master node
|
||||
- do:
|
||||
cluster.state: {}
|
||||
- set: { master_node: master }
|
||||
|
||||
- do:
|
||||
nodes.info:
|
||||
metric: [ http ]
|
||||
- is_true: nodes.$master.http.publish_address
|
||||
- set: { nodes.$master.http.publish_address: host }
|
||||
|
||||
- do:
|
||||
ingest.simulate:
|
||||
body:
|
||||
pipeline:
|
||||
description: _description
|
||||
processors: [ grok: { field: host, patterns : ["%{IPORHOST:hostname}:%{NUMBER:port:int}"]} ]
|
||||
docs: [ { _index: index, _type: type, _id: id, _source: { host: $host } } ]
|
||||
- set: { docs.0.doc._source.hostname: hostname }
|
||||
- set: { docs.0.doc._source.port: port }
|
||||
|
||||
- do:
|
||||
xpack.watcher.put_watch:
|
||||
id: "test_watch"
|
||||
body: >
|
||||
{
|
||||
"trigger": {
|
||||
"schedule": {
|
||||
"interval": "1s"
|
||||
}
|
||||
},
|
||||
"input": {
|
||||
"simple" : {
|
||||
"key" : "value"
|
||||
}
|
||||
},
|
||||
"condition": {
|
||||
"always" : {}
|
||||
},
|
||||
"actions": {
|
||||
"output": {
|
||||
"webhook" : {
|
||||
"method" : "PUT",
|
||||
"host" : "localhost",
|
||||
"port" : 9400,
|
||||
"path": "/my_index/my_type/{{ctx.watch_id}}",
|
||||
"body" : {
|
||||
"inline": {
|
||||
"watch_id" : "{{ctx.watch_id}}"
|
||||
},
|
||||
"params": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body:
|
||||
trigger:
|
||||
schedule:
|
||||
interval: 1s
|
||||
input:
|
||||
simple:
|
||||
key: value
|
||||
condition:
|
||||
always: {}
|
||||
actions:
|
||||
output:
|
||||
webhook:
|
||||
method: PUT
|
||||
host: $hostname
|
||||
port: $port
|
||||
path: "/my_index/my_type/{{ctx.watch_id}}"
|
||||
body:
|
||||
inline:
|
||||
watch_id: "{{ctx.watch_id}}"
|
||||
params: {}
|
||||
|
||||
- match: { _id: "test_watch" }
|
||||
- match: { created: true }
|
||||
|
||||
|
|
|
@ -16,50 +16,56 @@
|
|||
- match: { "watcher_state": "started" }
|
||||
- match: { "watch_count": 0 }
|
||||
|
||||
# extract http host and port from master node
|
||||
- do:
|
||||
cluster.state: {}
|
||||
- set: { master_node: master }
|
||||
|
||||
- do:
|
||||
nodes.info:
|
||||
metric: [ http ]
|
||||
- is_true: nodes.$master.http.publish_address
|
||||
- set: { nodes.$master.http.publish_address: host }
|
||||
|
||||
- do:
|
||||
ingest.simulate:
|
||||
body:
|
||||
pipeline:
|
||||
description: _description
|
||||
processors: [ grok: { field: host, patterns : ["%{IPORHOST:hostname}:%{NUMBER:port:int}"] } ]
|
||||
docs: [ { _index: index, _type: type, _id: id, _source: { host: $host } } ]
|
||||
- set: { docs.0.doc._source.hostname: hostname }
|
||||
- set: { docs.0.doc._source.port: port }
|
||||
|
||||
- do:
|
||||
xpack.watcher.put_watch:
|
||||
id: "test_watch"
|
||||
body: >
|
||||
{
|
||||
"metadata" : {
|
||||
"index" : "<date-index-{now/d}>"
|
||||
},
|
||||
"trigger": {
|
||||
"schedule": {
|
||||
"interval": "1h"
|
||||
}
|
||||
},
|
||||
"input": {
|
||||
"http" : {
|
||||
"request" : {
|
||||
"host" : "localhost",
|
||||
"port" : 9400,
|
||||
"path" : "/{{#url}}{{ctx.metadata.index}}{{/url}}/_search"
|
||||
}
|
||||
}
|
||||
},
|
||||
"condition" : {
|
||||
"compare" : {
|
||||
"ctx.payload.hits.total" : {
|
||||
"eq" : 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
"output": {
|
||||
"webhook" : {
|
||||
"method" : "PUT",
|
||||
"host" : "localhost",
|
||||
"port" : 9400,
|
||||
"path" : "/{{#url}}{{ctx.metadata.index}}{{/url}}/log/2",
|
||||
"params" : {
|
||||
"refresh" : "true"
|
||||
},
|
||||
"body" : "{ \"foo\": \"bar\" }"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body:
|
||||
metadata:
|
||||
index: "<date-index-{now/d}>"
|
||||
trigger:
|
||||
schedule:
|
||||
interval: 1h
|
||||
input:
|
||||
http:
|
||||
request:
|
||||
host: $hostname
|
||||
port: $port
|
||||
path: "/{{#url}}{{ctx.metadata.index}}{{/url}}/_search"
|
||||
condition:
|
||||
compare:
|
||||
"ctx.payload.hits.total":
|
||||
eq: 1
|
||||
actions:
|
||||
output:
|
||||
webhook:
|
||||
method: PUT
|
||||
host: $hostname
|
||||
port: $port
|
||||
path: "/{{#url}}{{ctx.metadata.index}}{{/url}}/log/2"
|
||||
params:
|
||||
refresh: "true"
|
||||
body: "{ \"foo\": \"bar\" }"
|
||||
|
||||
- match: { _id: "test_watch" }
|
||||
- match: { created: true }
|
||||
|
|
|
@ -22,7 +22,6 @@ integTestCluster {
|
|||
setting 'xpack.security.enabled', 'false'
|
||||
setting 'xpack.monitoring.enabled', 'false'
|
||||
setting 'xpack.ml.enabled', 'false'
|
||||
setting 'http.port', '9400'
|
||||
// Need to allow more compilations per minute because of the integration tests
|
||||
setting 'script.max_compilations_per_minute', '100'
|
||||
|
||||
|
|
|
@ -21,46 +21,53 @@ teardown:
|
|||
- match: { "watcher_state": "started" }
|
||||
- match: { "watch_count": 0 }
|
||||
|
||||
# extract http host and port from master node
|
||||
- do:
|
||||
cluster.state: {}
|
||||
- set: { master_node: master }
|
||||
|
||||
- do:
|
||||
nodes.info:
|
||||
metric: [ http ]
|
||||
- is_true: nodes.$master.http.publish_address
|
||||
- set: { nodes.$master.http.publish_address: host }
|
||||
|
||||
- do:
|
||||
ingest.simulate:
|
||||
body:
|
||||
pipeline:
|
||||
description: _description
|
||||
processors: [ grok: { field: host, patterns : ["%{IPORHOST:hostname}:%{NUMBER:port:int}"]} ]
|
||||
docs: [ { _index: index, _type: type, _id: id, _source: { host: $host } } ]
|
||||
- set: { docs.0.doc._source.hostname: hostname }
|
||||
- set: { docs.0.doc._source.port: port }
|
||||
|
||||
- do:
|
||||
xpack.watcher.put_watch:
|
||||
id: "cluster_health_watch"
|
||||
body: >
|
||||
{
|
||||
"trigger": {
|
||||
"schedule": {
|
||||
"interval": "1s"
|
||||
}
|
||||
},
|
||||
"input": {
|
||||
"http": {
|
||||
"request": {
|
||||
"host": "localhost",
|
||||
"port": 9400,
|
||||
"path": "/_cluster/health",
|
||||
"auth" : {
|
||||
"basic" : {
|
||||
"username" : "test_admin",
|
||||
"password" : "changeme"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"condition": {
|
||||
"compare": {
|
||||
"ctx.payload.number_of_data_nodes": {
|
||||
"lt": "10"
|
||||
}
|
||||
}
|
||||
},
|
||||
"actions": {
|
||||
"log": {
|
||||
"logging": {
|
||||
"text": "executed at {{ctx.execution_time}}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
body:
|
||||
trigger:
|
||||
schedule:
|
||||
interval: 1s
|
||||
input:
|
||||
http:
|
||||
request:
|
||||
host: $hostname
|
||||
port: $port
|
||||
path: "/_cluster/health"
|
||||
auth:
|
||||
basic:
|
||||
username: test_admin
|
||||
password: changeme
|
||||
condition:
|
||||
compare:
|
||||
"ctx.payload.number_of_data_nodes":
|
||||
lt: 10
|
||||
actions:
|
||||
log:
|
||||
logging:
|
||||
text: "executed at {{ctx.execution_time}}"
|
||||
|
||||
- match: { _id: "cluster_health_watch" }
|
||||
- match: { created: true }
|
||||
|
||||
|
|
Loading…
Reference in New Issue