summaryrefslogtreecommitdiff
path: root/rest-api-spec/test/cluster.state
diff options
context:
space:
mode:
authorHilko Bengen <bengen@debian.org>2014-06-07 12:02:12 +0200
committerHilko Bengen <bengen@debian.org>2014-06-07 12:02:12 +0200
commitd5ed89b946297270ec28abf44bef2371a06f1f4f (patch)
treece2d945e4dde69af90bd9905a70d8d27f4936776 /rest-api-spec/test/cluster.state
downloadelasticsearch-d5ed89b946297270ec28abf44bef2371a06f1f4f.tar.gz
Imported Upstream version 1.0.3upstream/1.0.3
Diffstat (limited to 'rest-api-spec/test/cluster.state')
-rw-r--r--rest-api-spec/test/cluster.state/10_basic.yaml6
-rw-r--r--rest-api-spec/test/cluster.state/20_filtering.yaml164
2 files changed, 170 insertions, 0 deletions
diff --git a/rest-api-spec/test/cluster.state/10_basic.yaml b/rest-api-spec/test/cluster.state/10_basic.yaml
new file mode 100644
index 0000000..1bea4ad
--- /dev/null
+++ b/rest-api-spec/test/cluster.state/10_basic.yaml
@@ -0,0 +1,6 @@
+---
+"cluster state test":
+ - do:
+ cluster.state: {}
+
+ - is_true: master_node
diff --git a/rest-api-spec/test/cluster.state/20_filtering.yaml b/rest-api-spec/test/cluster.state/20_filtering.yaml
new file mode 100644
index 0000000..7c77ea5
--- /dev/null
+++ b/rest-api-spec/test/cluster.state/20_filtering.yaml
@@ -0,0 +1,164 @@
+setup:
+ - do:
+ index:
+ index: testidx
+ type: testtype
+ id: testing_document
+ body:
+ "text" : "The quick brown fox is brown."
+ - do:
+ indices.refresh: {}
+
+---
+"Filtering the cluster state by blocks should return the blocks field even if the response is empty":
+ - do:
+ cluster.state:
+ metric: [ blocks ]
+
+ - is_true: blocks
+ - is_false: nodes
+ - is_false: metadata
+ - is_false: routing_table
+ - is_false: routing_nodes
+ - is_false: allocations
+ - length: { blocks: 0 }
+
+---
+"Filtering the cluster state by blocks should return the blocks":
+# read only index
+# TODO: can this cause issues leaving it read only when deleting it in teardown
+ - do:
+ indices.put_settings:
+ index: testidx
+ body:
+ index.blocks.read_only: true
+ - do:
+ cluster.state:
+ metric: [ blocks ]
+
+ - is_true: blocks
+ - is_false: nodes
+ - is_false: metadata
+ - is_false: routing_table
+ - is_false: routing_nodes
+ - is_false: allocations
+ - length: { blocks: 1 }
+
+---
+"Filtering the cluster state by nodes only should work":
+ - do:
+ cluster.state:
+ metric: [ nodes ]
+
+ - is_false: blocks
+ - is_true: nodes
+ - is_false: metadata
+ - is_false: routing_table
+ - is_false: routing_nodes
+ - is_false: allocations
+
+---
+"Filtering the cluster state by metadata only should work":
+ - do:
+ cluster.state:
+ metric: [ metadata ]
+
+ - is_false: blocks
+ - is_false: nodes
+ - is_true: metadata
+ - is_false: routing_table
+ - is_false: routing_nodes
+ - is_false: allocations
+
+
+---
+"Filtering the cluster state by routing table only should work":
+ - do:
+ cluster.state:
+ metric: [ routing_table ]
+
+ - is_false: blocks
+ - is_false: nodes
+ - is_false: metadata
+ - is_true: routing_table
+ - is_true: routing_nodes
+ - is_true: allocations
+
+
+---
+"Filtering the cluster state for specific index templates should work ":
+ - do:
+ indices.put_template:
+ name: test1
+ body:
+ template: test-*
+ settings:
+ number_of_shards: 1
+
+ - do:
+ indices.put_template:
+ name: test2
+ body:
+ template: test-*
+ settings:
+ number_of_shards: 2
+
+ - do:
+ indices.put_template:
+ name: foo
+ body:
+ template: foo-*
+ settings:
+ number_of_shards: 3
+ - do:
+ cluster.state:
+ metric: [ metadata ]
+ index_templates: [ test1, test2 ]
+
+ - is_false: blocks
+ - is_false: nodes
+ - is_true: metadata
+ - is_false: routing_table
+ - is_false: routing_nodes
+ - is_false: allocations
+ - is_true: metadata.templates.test1
+ - is_true: metadata.templates.test2
+ - is_false: metadata.templates.foo
+
+---
+"Filtering the cluster state by indices should work in routing table and metadata":
+ - do:
+ index:
+ index: another
+ type: type
+ id: testing_document
+ body:
+ "text" : "The quick brown fox is brown."
+
+ - do:
+ indices.refresh: {}
+
+ - do:
+ cluster.state:
+ metric: [ routing_table, metadata ]
+ index: [ testidx ]
+
+ - is_false: metadata.indices.another
+ - is_false: routing_table.indices.another
+ - is_true: metadata.indices.testidx
+ - is_true: routing_table.indices.testidx
+
+---
+"Filtering the cluster state using _all for indices and metrics should work":
+ - do:
+ cluster.state:
+ metric: [ '_all' ]
+ index: [ '_all' ]
+
+ - is_true: blocks
+ - is_true: nodes
+ - is_true: metadata
+ - is_true: routing_table
+ - is_true: routing_nodes
+ - is_true: allocations
+