Monitoring: Add REST test for monitoring bulk endpoint

Original commit: elastic/x-pack-elasticsearch@52166aec1f
This commit is contained in:
Tanguy Leroux 2016-03-23 17:39:37 +01:00
parent ffb70f3011
commit b056fed38b
2 changed files with 113 additions and 0 deletions

View File

@ -0,0 +1,35 @@
{
"monitoring.bulk": {
"documentation": "http://www.elastic.co/guide/en/marvel/current/appendix-api-bulk.html",
"methods": ["POST", "PUT"],
"url": {
"path": "/_x-pack/monitoring/_bulk",
"paths": ["/_x-pack/monitoring/_bulk", "/_x-pack/monitoring/{index}/_bulk", "/_x-pack/monitoring/{index}/{type}/_bulk"],
"parts": {
"index": {
"type" : "string",
"description" : "Default index for items which don't provide one"
},
"type": {
"type" : "string",
"description" : "Default document type for items which don't provide one"
}
},
"params": {
"system_id": {
"type": "string",
"description" : "Identifier of the monitored system"
},
"system_version" : {
"type" : "string",
"description" : "Version of the monitored system"
}
}
},
"body": {
"description" : "The operation definition and data (action-data pairs), separated by newlines",
"required" : true,
"serialize" : "bulk"
}
}
}

View File

@ -0,0 +1,78 @@
---
"Bulk indexing of monitoring data":
# Get the current version
- do: {info: {}}
- set: {version.number: version}
- do:
monitoring.bulk:
system_id: "kibana"
system_version: $version
body:
- index:
_type: test_type
- avg-cpu:
user: 13.26
nice: 0.17
system: 1.51
iowait: 0.85
idle: 84.20
- index:
_type: test_type
- avg-cpu:
user: 13.23
nice: 0.17
system: 1.51
iowait: 0.85
idle: 84.24
- is_false: errors
- do:
indices.refresh: {}
- do:
count:
index: .monitoring-kibana-*
- match: {count: 2}
---
"Bulk indexing of monitoring data using default type":
# Get the current version
- do: {info: {}}
- set: {version.number: version}
- do:
monitoring.bulk:
system_id: "kibana"
system_version: $version
index: "default_index"
type: "default_type"
body:
- '{"index": {}}'
- '{"field_1": "value_1"}'
- '{"index": {"_type": "test_type"}}'
- '{"field_1": "value_2"}'
- '{"index": {}}'
- '{"field_1": "value_3"}'
- is_false: errors
- do:
indices.refresh: {}
- do:
search:
index: .monitoring-kibana-*
type: default_type
- match: { hits.total: 2 }
- do:
search:
index: .monitoring-kibana-*
type: test_type
- match: { hits.total: 1 }