Browse Source

[TEST] Added REST tests for _cat/thread_pool endpoint

Luca Cavanna 11 years ago
parent
commit
dbc2ba22a8

+ 42 - 0
rest-api-spec/api/cat.thread_pool.json

@@ -0,0 +1,42 @@
+{
+  "cat.thread_pool": {
+    "documentation": "http://www.elasticsearch.org/guide/en/elasticsearch/reference/master/cat-thread-pool.html",
+    "methods": ["GET"],
+    "url": {
+      "path": "/_cat/thread_pool",
+      "paths": ["/_cat/thread_pool"],
+      "parts": {
+      },
+      "params": {
+        "local": {
+          "type" : "boolean",
+          "description" : "Return local information, do not retrieve the state from master node (default: false)"
+        },
+        "master_timeout": {
+          "type" : "time",
+          "description" : "Explicit operation timeout for connection to master node"
+        },
+        "h": {
+            "type": "list",
+            "description" : "Comma-separated list of column names to display"
+        },
+        "help": {
+          "type": "boolean",
+          "description": "Return help information",
+          "default": false
+        },
+        "v": {
+          "type": "boolean",
+          "description": "Verbose mode. Display column headers",
+          "default": false
+        },
+        "full_id": {
+          "type": "boolean",
+          "description": "Enables displaying the complete node ids",
+          "default": false
+        }
+      }
+    },
+    "body": null
+  }
+}

+ 45 - 0
rest-api-spec/test/cat.thread_pool/10_basic.yaml

@@ -0,0 +1,45 @@
+---
+setup:
+  - skip:
+      features: regex
+
+---
+"Test cat thread_pool output":
+
+  - do:
+      cat.thread_pool: {}
+
+  - match:
+      $body: >
+               /  #host       ip                          bulk.active       bulk.queue       bulk.rejected       index.active       index.queue       index.rejected       search.active       search.queue       search.rejected
+               ^  (\S+   \s+  (\d{1,3}\.){3}\d{1,3}  \s+  \d+          \s+  \d+         \s+  \d+            \s+  \d+           \s+  \d+          \s+  \d+             \s+  \d+            \s+  \d+           \s+  \d+              \s+  \n)+  $/
+
+  - do:
+      cat.thread_pool:
+          v: true
+
+  - match:
+      $body: >
+               /^ host  \s+  ip                     \s+  bulk.active  \s+  bulk.queue  \s+  bulk.rejected  \s+  index.active  \s+  index.queue  \s+  index.rejected  \s+  search.active  \s+  search.queue  \s+  search.rejected  \s+  \n
+                 (\S+   \s+  (\d{1,3}\.){3}\d{1,3}  \s+  \d+          \s+  \d+         \s+  \d+            \s+  \d+           \s+  \d+          \s+  \d+             \s+  \d+            \s+  \d+           \s+  \d+              \s+  \n)+  $/
+
+  - do:
+      cat.thread_pool:
+          h: pid,id,h,i,po
+
+  - match:
+      $body: >
+               /  #pid       id          host       ip                          port
+               ^  (\d+  \s+  \S{4}  \s+  \S+   \s+  (\d{1,3}\.){3}\d{1,3}  \s+  \d{4}  \n)+  $/
+
+  - do:
+      cat.thread_pool:
+          h: id,ba,fa,gea,ga,ia,maa,ma,oa,pa
+          v: true
+          full_id: true
+
+  - match:
+      $body: >
+               /^  id   \s+  ba   \s+  fa   \s+  gea  \s+  ga   \s+  ia   \s+  maa  \s+  ma   \s+  oa   \s+  pa  \s+  \n
+                  (\S+  \s+  \d+  \s+  \d+  \s+  \d+  \s+  \d+  \s+  \d+  \s+  \d+  \s+  \d+  \s+  \d+  \s+  \d+ \s+  \n)+  $/
+